0% found this document useful (0 votes)
5 views8 pages

ToSolve LeetCode

The document outlines a comprehensive guide for mastering programming concepts and problem-solving skills, focusing on logic building, mathematics, data structures, and algorithms. It includes key concepts, must-try problems, and a study order to prepare for coding challenges on platforms like LeetCode. The checklist emphasizes essential areas such as logic, math, arrays, strings, recursion, sorting, data structures, pointers, and complexity analysis.

Uploaded by

diwatevilas23
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views8 pages

ToSolve LeetCode

The document outlines a comprehensive guide for mastering programming concepts and problem-solving skills, focusing on logic building, mathematics, data structures, and algorithms. It includes key concepts, must-try problems, and a study order to prepare for coding challenges on platforms like LeetCode. The checklist emphasizes essential areas such as logic, math, arrays, strings, recursion, sorting, data structures, pointers, and complexity analysis.

Uploaded by

diwatevilas23
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

🧠 1.

Logic Building & Problem Solving Basics


Goal: Learn to think in steps, loops, and conditions efficiently.

✅ Key Concepts

 Flow of control: loops (for, while), conditions (if, else), and nested logic
 Tracing dry runs by hand
 Writing pseudocode for small problems
 Understanding time complexity (Big O) and space complexity
 Learn pattern of thinking: break → subproblem → solve → combine

🧩 Must Try Problems

 Find largest/smallest element in array


 Count digits / reverse a number
 Sum of digits
 Check prime number efficiently (√n approach)
 Find GCD / LCM (Euclid’s algorithm)
 Fibonacci iterative and recursive
 Armstrong / Strong number (for loops + condition practice)

🧮 2. Mathematics & Number Manipulation


Goal: Build mathematical intuition for patterns, divisibility, and digit-level manipulation.

✅ Key Concepts

 Factors, multiples
 Modulo arithmetic and integer overflow awareness
 Bitwise basics (AND, OR, XOR, shift)
 Base conversions (binary ↔ decimal)
 Fast exponentiation (power(a,b) in log(b) time)

🧩 Must Try Problems

 Count number of set bits


 Check power of 2 / 3 / 4
 Find unique number in an array using XOR
 Reverse digits of an integer
 Palindrome number without converting to string
1.3. Arrays — Pre-LeetCode Level
Before doing 2-pointer / sliding window on LeetCode, you must first master basic array
manipulation.

✅ Key Concepts

 Traversal & indexing


 Swapping elements
 Reversing array manually
 Rotating array (left/right by 1 or k positions)
 Prefix sum & running total logic
 Frequency counting using arrays or hashmaps

🧩 Must Try Problems

 Rotate array by k steps (using temporary array)


 Find second largest element
 Count even/odd elements
 Find missing number from 1–n
 Move all negatives to one side

🧩 1. Arrays & Strings


Core Concepts: Traversal, Prefix Sum, Two Pointers, Sliding Window, Hashing

Level Problem LeetCode ID


Easy Two Sum #1
Easy Best Time to Buy and Sell Stock #121
Easy Move Zeroes #283
Medium Kadane’s Algorithm (Maximum Subarray) #53
Medium Product of Array Except Self #238
Medium Sort Colors (Dutch National Flag) #75
Medium 3Sum #15
Medium Container With Most Water #11
Medium Longest Substring Without Repeating Characters #3

4. Strings — Pre-LeetCode Level


Goal: Be comfortable with both char[] and std::string.

✅ Key Concepts

 ASCII & character manipulation (tolower, toupper, difference between 'a' and 'A')
 String traversal and concatenation
 Frequency array for characters
 Removing spaces, counting vowels, etc.
 Palindrome check
 String reversal logic

🧩 Must Try Problems

 Reverse string manually


 Check if two strings are anagrams
 Find first non-repeating character
 Count words / vowels / consonants

Functions, Recursion & Call Stack Fundamentals


Before using recursion on LeetCode (like subsets, backtracking, etc.), you must know how
recursion actually works.

✅ Key Concepts

 Function calling flow


 Stack frames & base cases
 Difference between recursion and iteration
 Tail recursion
 Recurrence relations & complexity

🧩 Must Try Problems

 Factorial using recursion


 Sum of digits recursively
 Fibonacci recursively
 Print numbers from 1 to N recursively
 Reverse a string using recursion n

🔁 2. Searching & Sorting


Basic Searching & Sorting (Implementation Level)
Before LeetCode’s binary search-based problems, implement them yourself once.

✅ Key Concepts

 Linear Search, Binary Search (iterative + recursive)


 Selection, Bubble, Insertion Sort
 Understanding why sorting helps in optimization
 Sorting + Two Pointer combination

🧩 Must Try Problems

 Implement binary search manually


 Implement bubble/selection/insertion sort
 Merge two sorted arrays
 Find frequency of element in sorted array using binary search

Concepts: Binary Search, Sorting Techniques, Pivot Finding

Level Problem LeetCode ID


Easy Binary Search #704
Medium Search in Rotated Sorted Array #33
Medium Find First and Last Position of Element #34
Medium Kth Largest Element in an Array #215
Medium Merge Intervals #56

🧮 3. Mathematics & Number Theory


Level Problem LeetCode ID
Easy Reverse Integer #7
Easy Palindrome Number #9
Easy Power of Two #231
Medium Excel Sheet Column Number #171

⚙️4. Hashing / Maps / Sets


Level Problem LeetCode ID
Easy Valid Anagram #242
Easy Intersection of Two Arrays #349
Medium Group Anagrams #49
Medium Subarray Sum Equals K #560

🧵 5. Linked List
Level Problem LeetCode ID
Easy Reverse Linked List #206
Easy Middle of the Linked List #876
Medium Merge Two Sorted Lists #21
Medium Remove Nth Node From End #19
Level Problem LeetCode ID
Medium Detect Cycle in a Linked List #141
Medium Add Two Numbers #2

🌳 6. Stacks & Queues


Level Problem LeetCode ID
Easy Valid Parentheses #20
Easy Min Stack #155
Medium Implement Queue using Stacks #232
Medium Next Greater Element #496
Medium Daily Temperatures #739

🌲 7. Binary Trees & BST


Level Problem LeetCode ID
Easy Maximum Depth of Binary Tree #104
Easy Symmetric Tree #101
Medium Binary Tree Level Order Traversal #102
Medium Validate Binary Search Tree #98
Medium Lowest Common Ancestor of BST #235
Medium Diameter of Binary Tree #543

🔄 8. Recursion & Backtracking


Level Problem LeetCode ID
Easy Fibonacci Number #509
Medium Subsets #78
Medium Permutations #46
Medium Combination Sum #39
Medium N-Queens #51

🧠 9. Dynamic Programming (DP)


Level Problem LeetCode ID
Easy Climbing Stairs #70
Medium House Robber #198
Medium Coin Change #322
Medium Longest Increasing Subsequence #300
Medium Unique Paths #62
Hard Edit Distance #72
🧭 10. Graphs
Level Problem LeetCode ID
Medium Number of Islands #200
Medium Clone Graph #133
Medium Course Schedule (Topological Sort) #207
Medium Rotting Oranges #994

🧮 11. Bit Manipulation


Level Problem LeetCode ID
Easy Single Number #136
Easy Number of 1 Bits #191
Medium Counting Bits #338
Medium Subsets (Using Bitmask) #78

📋 12. Miscellaneous (Must for Interview Rounds)


Level Problem LeetCode ID
Medium LRU Cache #146
Medium Implement Trie #208
Medium Top K Frequent Elements #347

💡 Study Tip Order

1. Arrays & Strings


2. Searching & Sorting
3. Linked List
4. Stacks & Queues
5. Trees
6. Recursion & Backtracking
7. Dynamic Programming
8. Graphs
9. Bit Manipulation

7. Basic Data Structures (Hand-Built Implementation


Level)
LeetCode assumes you already understand what DS does internally — so it’s essential to
implement the basics manually once.
✅ Key Concepts

 Stack using array/vector


 Queue using array/vector
 Linked List (singly & doubly) basic operations: insert, delete, reverse
 Understanding push/pop/front/back behavior

🧩 Must Try Problems

 Reverse linked list manually


 Detect loop using fast/slow pointers (Floyd’s)
 Implement stack using arrays
 Implement queue using arrays

🌳 8. Pointers & Memory Concepts (C++ specific)


If you use C++ for DSA, this part is crucial.

✅ Key Concepts

 Reference vs pointer
 Dynamic allocation (new/delete)
 Pointer arithmetic
 Pass-by-reference vs pass-by-value
 Working with arrays through pointers

🧩 Must Try Tasks

 Write a function that swaps two numbers using pointers


 Create a dynamic array
 Print array elements using pointer notation
 Return pointer from a function safely

⚙️9. STL (C++ Standard Template Library)


Goal: Use STL efficiently in LeetCode — no need to re-implement everything.

✅ Key Components

 vector, pair, map, unordered_map, set, unordered_set


 stack, queue, priority_queue
 sort(), reverse(), accumulate(), find(), binary_search()
 Iterators, auto keyword
 Range-based loops

🧩 Must Try Tasks


 Sort vector of pairs by second element
 Find frequency of elements using map
 Use unordered_set to remove duplicates
 Implement min-heap and max-heap using priority_queue

🧩 10. Complexity & Optimization Thinking


LeetCode often tests optimization mindset. Before you start, get used to analyzing your code.

✅ Learn

 How nested loops affect time complexity


 When to use hashmap over nested loops
 Why sorting first may reduce complexity
 Space vs time tradeoff

🧩 Practice Questions

 Compare two approaches for sum of pairs = target


 Reduce O(n²) brute force to O(n log n) or O(n) using sorting or maps
 Count distinct elements using map/set

✅ TL;DR — Pre-LeetCode Checklist


Area Must Be Confident In

Logic Building Loops, conditions, dry run, time complexity

Math Digits, primes, GCD, modulo, powers

Arrays Traversal, rotation, prefix sums

Strings ASCII, palindrome, frequency

Recursion Base case + call flow

Sorting/Searching Binary search + basic sorts

Data Structures Stack, Queue, Linked List basics

Pointers References, memory basics

STL vector, map, set, etc.

Complexity Big O analysis

You might also like