Skip to main content

Command Palette

Search for a command to run...

125 Essential Problems from LeetCode

Updated
7 min read
J

I am Jyotiprakash, a deeply driven computer systems engineer, software developer, teacher, and philosopher. With a decade of professional experience, I have contributed to various cutting-edge software products in network security, mobile apps, and healthcare software at renowned companies like Oracle, Yahoo, and Epic. My academic journey has taken me to prestigious institutions such as the University of Wisconsin-Madison and BITS Pilani in India, where I consistently ranked among the top of my class.

At my core, I am a computer enthusiast with a profound interest in understanding the intricacies of computer programming. My skills are not limited to application programming in Java; I have also delved deeply into computer hardware, learning about various architectures, low-level assembly programming, Linux kernel implementation, and writing device drivers. The contributions of Linus Torvalds, Ken Thompson, and Dennis Ritchie—who revolutionized the computer industry—inspire me. I believe that real contributions to computer science are made by mastering all levels of abstraction and understanding systems inside out.

In addition to my professional pursuits, I am passionate about teaching and sharing knowledge. I have spent two years as a teaching assistant at UW Madison, where I taught complex concepts in operating systems, computer graphics, and data structures to both graduate and undergraduate students. Currently, I am an assistant professor at KIIT, Bhubaneswar, where I continue to teach computer science to undergraduate and graduate students. I am also working on writing a few free books on systems programming, as I believe in freely sharing knowledge to empower others.

Arrays (10 problems)

Master the fundamentals of array manipulation, from basic traversals to advanced techniques.

Easy Problems

  1. Best Time to Buy and Sell Stock (#121) - Single pass tracking

  2. Maximum Subarray (#53) - Kadane's algorithm

  3. Plus One (#66) - Array digit manipulation

  4. Pascal's Triangle (#118) - 2D array generation

  5. Majority Element (#169) - Boyer-Moore voting

  6. Missing Number (#268) - Math/XOR trick

  7. Find Pivot Index (#724) - Prefix sum

Medium Problems

  1. Product of Array Except Self (#238) - Prefix/suffix products

  2. Find All Numbers Disappeared in an Array (#448) - In-place marking

  3. Rotate Array (#189) - Array rotation techniques


Hashing - HashMaps & HashSets (15 problems)

Master the art of O(1) lookups and understand when and how to use hash-based data structures.

Easy Problems

  1. Two Sum (#1) - Classic HashMap for pair finding

  2. Contains Duplicate (#217) - HashSet basics

  3. Valid Anagram (#242) - Character frequency map

  4. Happy Number (#202) - HashSet for cycle detection

  5. Intersection of Two Arrays (#349) - Set operations

  6. Single Number (#136) - Bit manipulation vs hashing

  7. Isomorphic Strings (#205) - Bijection with HashMap

  8. Word Pattern (#290) - Pattern matching with HashMap

  9. First Unique Character in a String (#387) - Frequency counting

Medium Problems

  1. Group Anagrams (#49) - HashMap with string keys

  2. Longest Consecutive Sequence (#128) - HashSet for O(n) solution

  3. Subarray Sum Equals K (#560) - HashMap + prefix sum

  4. Top K Frequent Elements (#347) - HashMap + bucket sort

  5. LRU Cache (#146) - HashMap + Doubly Linked List

  6. Copy List with Random Pointer (#138) - HashMap for deep copy


Two Pointers (12 problems)

Essential technique for optimizing array and string problems from O(n²) to O(n).

Easy Problems

  1. Move Zeroes (#283) - Basic two pointer

  2. Remove Duplicates from Sorted Array (#26) - In-place manipulation

  3. Merge Sorted Array (#88) - Two pointer merge

  4. Valid Palindrome (#125) - Two pointer from ends

  5. Reverse String (#344) - Two pointer swap

  6. Two Sum II - Input Array Is Sorted (#167) - Two pointer on sorted

  7. Intersection of Two Arrays II (#350) - Two pointer intersection

Medium Problems

  1. 3Sum (#15) - Three pointers

  2. Container With Most Water (#11) - Greedy two pointer

  3. Sort Colors (#75) - Dutch flag problem

  4. Remove Duplicates from Sorted Array II (#80) - Two pointer with count

  5. 3Sum Closest (#16) - Three pointer variant


Linked Lists (10 problems)

Master pointer manipulation and understand the elegance of recursive solutions.

Easy Problems

  1. Reverse Linked List (#206) - Fundamental operation

  2. Merge Two Sorted Lists (#21) - Two pointer merge

  3. Linked List Cycle (#141) - Floyd's cycle detection

  4. Palindrome Linked List (#234) - Fast/slow pointer

  5. Remove Duplicates from Sorted List (#83) - Traversal

  6. Intersection of Two Linked Lists (#160) - Two pointer

  7. Middle of the Linked List (#876) - Fast/slow pointer

Medium Problems

  1. Remove Nth Node From End of List (#19) - Two pointer with gap

  2. Add Two Numbers (#2) - Linked list arithmetic

  3. Linked List Cycle II (#142) - Cycle detection + entry point


Stacks (8 problems)

LIFO operations and their powerful applications in parsing and expression evaluation.

Easy Problems

  1. Valid Parentheses (#20) - Classic stack

  2. Implement Queue using Stacks (#232) - Stack manipulation

  3. Backspace String Compare (#844) - Stack simulation

  4. Next Greater Element I (#496) - Monotonic stack intro

  5. Min Stack (#155) - Stack with min operation

Medium Problems

  1. Evaluate Reverse Polish Notation (#150) - Expression evaluation

  2. Daily Temperatures (#739) - Monotonic stack

  3. Decode String (#394) - Nested stack operations


Queues & Priority Queues (7 problems)

FIFO operations and heap-based priority management.

Easy Problems

  1. Implement Stack using Queues (#225) - Queue manipulation

  2. Number of Recent Calls (#933) - Queue basics

  3. Last Stone Weight (#1046) - Max heap basics

  4. KthLargest Element in a Stream (#703) - Min heap maintenance

Medium Problems

  1. Kth Largest Element in an Array (#215) - Priority queue/quickselect

  2. K Closest Points to Origin (#973) - Priority queue

  3. Task Scheduler (#621) - Priority queue + greedy


Binary Trees (13 problems)

Tree traversals, recursive thinking, and structural properties.

Easy Problems

  1. Maximum Depth of Binary Tree (#104) - Basic DFS/BFS

  2. Invert Binary Tree (#226) - Tree manipulation

  3. Same Tree (#100) - Tree comparison

  4. Symmetric Tree (#101) - Mirror comparison

  5. Binary Tree Inorder Traversal (#94) - Traversal

  6. Path Sum (#112) - Root-to-leaf path

  7. Minimum Depth of Binary Tree (#111) - BFS/DFS

  8. Balanced Binary Tree (#110) - Height calculation

  9. Diameter of Binary Tree (#543) - Path through node

  10. Subtree of Another Tree (#572) - Tree matching

Medium Problems

  1. Binary Tree Level Order Traversal (#102) - BFS layers

  2. Validate Binary Search Tree (#98) - BST property

  3. Binary Tree Right Side View (#199) - Level traversal


Binary Search Trees (6 problems)

Leverage BST properties for efficient searching and manipulation.

Easy Problems

  1. Search in a Binary Search Tree (#700) - BST basics

  2. Convert Sorted Array to Binary Search Tree (#108) - BST construction

  3. Lowest Common Ancestor of a Binary Search Tree (#235) - BST properties

  4. Range Sum of BST (#938) - BST traversal

Medium Problems

  1. Kth Smallest Element in a BST (#230) - Inorder traversal

  2. Lowest Common Ancestor of a Binary Tree (#236) - Tree recursion


Graphs - BFS/DFS (10 problems)

Graph traversal techniques and their applications in connected components and shortest paths.

Easy Problems

  1. Flood Fill (#733) - Basic DFS/BFS

  2. Island Perimeter (#463) - Grid traversal

  3. Find if Path Exists in Graph (#1971) - Graph traversal

Medium Problems

  1. Number of Islands (#200) - DFS/BFS on grid

  2. Max Area of Island (#695) - DFS with counting

  3. Rotting Oranges (#994) - Multi-source BFS

  4. Course Schedule (#207) - Topological sort

  5. Pacific Atlantic Water Flow (#417) - Multi-source DFS

  6. Clone Graph (#133) - Graph traversal + copying

  7. Word Search (#79) - DFS with backtracking


Binary Search (8 problems)

O(log n) searching and its creative applications beyond sorted arrays.

Easy Problems

  1. Binary Search (#704) - Classic binary search

  2. First Bad Version (#278) - Binary search application

  3. Search Insert Position (#35) - Binary search variant

  4. Sqrt(x) (#69) - Binary search on answer

  5. Guess Number Higher or Lower (#374) - Interactive binary search

Medium Problems

  1. Find Peak Element (#162) - Binary search on unsorted

  2. Search in Rotated Sorted Array (#33) - Modified binary search

  3. Find First and Last Position of Element in Sorted Array (#34) - Binary search bounds


Sorting (5 problems)

Understanding different sorting algorithms and their applications.

Easy Problems

  1. Squares of a Sorted Array (#977) - Two pointer sorting

  2. Sort Array By Parity (#905) - Partition algorithm

Medium Problems

  1. Majority Element II (#229) - Boyer-Moore extended

  2. Merge Intervals (#56) - Sort + merge

  3. Sort an Array (#912) - Implement sorting algorithm


Divide and Conquer (6 problems)

Breaking problems into smaller subproblems and combining solutions.

Easy Problems

  1. Maximum Subarray (#53) - Can use D&C approach

  2. Majority Element (#169) - Can use D&C approach

  3. Merge Two Sorted Lists (#21) - Base for merge sort

Medium Problems

  1. Sort List (#148) - Merge sort on linked list

  2. Kth Largest Element in an Array (#215) - Quickselect

  3. Search a 2D Matrix II (#240) - D&C on matrix


Greedy (8 problems)

Making locally optimal choices to reach global optimum.

Easy Problems

  1. Assign Cookies (#455) - Basic greedy

  2. Maximum Units on a Truck (#1710) - Greedy sorting

  3. Can Place Flowers (#605) - Greedy placement

  4. Lemonade Change (#860) - Greedy change-making

Medium Problems

  1. Jump Game (#55) - Greedy reachability

  2. Jump Game II (#45) - Greedy optimization

  3. Gas Station (#134) - Greedy circular array

  4. Meeting Rooms II (#253) - Interval scheduling


Backtracking (8 problems)

Systematic exploration of solution space with pruning.

Easy Problems

  1. Letter Case Permutation (#784) - Basic backtracking

  2. Binary Tree Paths (#257) - Tree backtracking

Medium Problems

  1. Combinations (#77) - Classic backtracking

  2. Permutations (#46) - Permutation generation

  3. Subsets (#78) - Subset generation

  4. Generate Parentheses (#22) - Recursive generation

Hard Problems (Essential Classics)

  1. N-Queens (#51) - Classic constraint satisfaction

  2. Sudoku Solver (#37) - Constraint propagation


More from this blog

Jyotiprakash's Blog

251 posts

I'm Jyotiprakash, a software dev and professor at KIIT, with expertise in system programming.