Have you ever wanted to connect with your friends on LeetCode? Well thanks to four students who participated in the University of Rochester’s DandyHacks2024 hackathon, now you can!
What is LeetCode?
LeetCode is a popular computer programming challenge platform that allows users to practice their problem-solving skills. The site contains a wide variety of programming puzzles of ranging difficulty, requiring clever manipulation of data and proficiency in useful algorithms.
For each problem, the user is given an input data structure and they must create a program that will generate the required output. For example, in the first problem on the general problems list, “Two Sum”, the user is given an array of integers and a target sum, and they must find the two integers that add up to the sum. One might think this problem is as simple as looping through the array for each element in the list to test if they add up to the target sum, but that method ends up being inefficient because it requires a time complexity of O(n2). Instead, users can leverage their proficiency with a fundamental data structure in computer science, hashtables, to keep a record of which integers have already been seen as the program scans through the array. While it requires extra space to store the record, this strategy reduces the time complexity of the algorithm to O(n), which is much more efficient, making it one of the optimal solutions.
Users can choose to create their program solution in a variety of languages, and LeetCode boasts support for many of them, including Python, Java, C++, Rust, Swift, Ruby, and many more. Regardless of which language they choose, users have a few options when they think their solution is complete. First, they can choose to run their program against a handful of test cases. The test cases provide an example input and the expected output. For example, in Two Sum, the first test case provides an integer array of [2, 7, 11, 15] and a target sum of 9 for the input, and the user’s program is expected to find that the first two elements, 2 and 7, are the pair that add up to the target sum of 9. If a user runs their program against this test case, they will see exactly what their program outputted in comparison to what the expected output was, thereby aiding in the debugging process. After the user has tested their program, they can choose to submit it for more detailed analysis. In this phase, the user’s solution will be validated against many more test cases, especially with difficult corner cases in problems where they exist. Then, the results will be calculated and shown to the user.
The first part of the results shown to the user is their correctness. The user will see how many validation test cases their program was run against, and for how many of them their program outputted the correct solution—a challenge can only be completed when all test cases are correct. After that, LeetCode will determine how efficient the solution is with respect to time and space complexity estimations. When the solution is run against validation test cases, its runtime and peak memory usage are measured as well. Then, LeetCode will compare the user’s measurements with up to thousands of other submissions that used the same programming language in order to determine the user’s ranking on a percentile scale. While these results are not true asymptotic analysis, they give a good enough indication of how efficient an algorithm is compared to other methods, and they can help the user assess how well their work would perform in real-world situations.
Our Product
Overall, LeetCode is a great tool, but unfortunately users complete puzzles independently, which can make the practice isolating at times. In addition, it can be difficult to maintain enough motivation to practice LeetCode consistently. Hence, for the University of Rochester's 2024 DandyHacks hackathon, my teammates Leo, Jacob, Ian, and I created Jile LL & Friends, a Chrome Extension that allows LeetCode users to connect with their friends. When a user logs into LeetCode and clicks on our extension, the app will display a basic user interface with a Leaderboard and a Friends tab. As a result of the hackathon, we ran out of time to implement a Challenges tab as well, but it is an idea we have for the future.
On the Friends tab, users can enter the username of other users on LeetCode, and click "Add Friend" to submit a friend request. Then, when the other user logs in to that account, they will see a friend request on their own friends panel. In order to determine which account the friend request is being sent to, we just use the plain text of the account username, so make sure to type it in correctly. On the Leaderboard tab, users can compare their results on certain problems with their friends. When the user navigates to the problem on LeetCode, they can click the Leaderboard tab to see their friends' runtime and memory results on a problem if they've completed the challenge. This way, LeetCode users are not just competing with an anonymous percentile, but with people they actually know. Unfortunately, we did not have time to implement the Challenges tab during the strict time constraints of the DandyHacks2024 hackathon, but our idea was to allow users to send a problem to their friend as a challenge as well. In this case, their friend would have a certain amount of time to complete the problem before the challenge expires, and if they do, they can see which user won.
For the front end of our application, we wrote HTML, CSS, and JavaScript by hand to build the interface. To integrate our extension with the LeetCode site, we scraped key elements from the LeetCode webpage, which allowed us to identify when a user was viewing a specific problem and extract relevant data like problem IDs and titles. This was essential for matching user activity with their statistics and displaying accurate information on the Leaderboard. On the back end, we used Node.js to build our server and hosted it on an AWS EC2 instance. Our data was stored in a PostgreSQL database, which kept track of users, friendships, and problem results. This backend setup allowed us to handle friend requests, maintain persistent user data, and support real-time interactions between users. To collect statistics such as runtime and memory usage for completed problems, we queried LeetCode’s GraphQL—a query language that allows clients to request data from an API.
DandyHacks2024: The Development Process
I’m thrilled to announce that our project won first place in the Community Track of DandyHacks2024! To compete in DandyHacks, contestants had 42 hours to submit a project in the Community Track, the Efficiency & Workflow Track, or the Entertainment Track. Then, regardless of how sleep-deprived everyone was, contestants conducted a short presentation about their projects in front of a judging panel of three faculty and three students associated with the competition. Projects were not allowed to have been started before the official start time on November 15th at 6:00pm (although on the honor system, brainstorming ideas was allowed), and projects must have been submitted by November 17th at 10:00am.
For the Community Track, our prompt was “How do we use technology to connect people?” Hence, after deciding to focus our project on LeetCode, we began to brainstorm the best ways to connect people. We came up with all kinds of ideas including an in-game form of currency and a new metric for success on the problems that combined both time and space complexity, but we decided to settle on the Leaderboard, Friends, and Challenges tabs due to time-constraints. After that, we designed a basic wireframe for the application in Balsamiq, created a list of APIs that the front-end would need the back-end to support, and split into teams. Jacob and Ian worked on the front-end while Leo and I worked on the back-end. However, despite this split, our shared understanding of the project direction and having the same workstation made the project feel collaborative and helped the development run smoothly.
Overall, the competition was a highly memorable experience. I’m grateful to Major League Hacking for their effort to put on the hackathon—they did a great job setting up the space with games, holding presentations, and building excitement for the prizes. Our team got an alarmingly low amount of sleep throughout the weekend and we primarily ran on the ramen, pizza, and caffeine-infused chocolate MLH provided, but it was all worth it when we and submitted our project and successfully created an awesome app! Here are our presentation slides, and here is the page we wrote on the DandyHacks2024 Devpost. Let’s go JILE LL & Friends!


