This document provides an overview of how to use LeetCode OJ (Online Judge) to practice algorithms and coding interview problems. It describes the problem categories (Easy, Medium, Hard), how to filter problems by topic and difficulty, view solutions, submit code, and check results. The goal is to help users efficiently practice and improve their coding skills for technical interviews.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
52 views
2.1 02 LeetCode OJ
This document provides an overview of how to use LeetCode OJ (Online Judge) to practice algorithms and coding interview problems. It describes the problem categories (Easy, Medium, Hard), how to filter problems by topic and difficulty, view solutions, submit code, and check results. The goal is to help users efficiently practice and improve their coding skills for technical interviews.
PhD from Simon Fraser University - Canada Bachelor / Msc from Cairo University - Egypt Ex-(Software Engineer / ICPC World Finalist) Visit: https://leetcode.com ● Click The Problems tab Problems list 3 Difficulty Levels ● Easy ○ Basic problems to warm up (e.g. search for a number in a sorted array) ○ A good tool to speed up coding skills ● Medium ○ These are the core and most important problems ● Hard ○ Out of scope most of the time during the course ■ Also rarely comes in interviews, especially lengthy text or code problems ○ Hard problems are important for competitive programming. But better do hard problems from other OJs (e.g. Codeforces) ● Label Accuracy: You will encounter some problems with inaccurate labels Filtering Topics ● From tags: you can choose to concentrate exclusively on topics of interest ● In the 'Difficulty' tab, you can sort them from easy to medium to hard ● Notice that Problem #314 is only available for premium subscription Solutions & Frequency tabs ● Solutions ○ Some problems have text solutions ○ Some problems have video + text solutions ○ There are also problems without solutions! ○ There are free and 'paid content' solutions ■ There are many solutions on GeeksforGeeks ■ There are also many YouTube videos ● Frequency ○ Subscriber only ○ You can get information on general frequency ○ And even frequency for a specific company Open a problem ● 4 tabs ● The Discussions tab is a great one: you can check if other people have alternative or more succinct solutions. Occasionally, an idea/code in this tab is superior to that of the editorial ○ Submissions with many languages. Search for your preferred language ● Avoid problems that are seriously hated by others Problem Solving part ● From the menu, select your language ● It generates the function name ● Fill in this code ● In the submission, never include the main function ● You must use the requested class name Problem Solving part: languages Problem Solving part: C++ Final code ● No main() ● No printing to the screen ● You don’t even need to use #includes ● If they defined a class, don’t add to submitted code ● For me ○ I code locally ○ Then rename the main to main1 Test and Submit buttons ● Before submitting your code, you can run some of the test cases ○ Copy-paste from the problem. ○ Strictly follow the available style ○ Sometimes it is hard to understand the test case structure Result ● If 'Failed', you can check out the relevant test cases ● If successful, there is a time and memory comparison with other solutions ○ If your code already has good complexity, don't waste much time here “Acquire knowledge and impart it to the people.”
Instant Access to (Ebook) Algorithms For Competitive Programming by David Esparza Alba,J A Ruiz Leal ISBN 9788700297067, 9798700297066, 8700297062 ebook Full Chapters