125 Essential Problems from LeetCode
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
Best Time to Buy and Sell Stock (#121) - Single pass tracking
Maximum Subarray (#53) - Kadane's algorithm
Plus One (#66) - Array digit manipulation
Pascal's Triangle (#118) - 2D array generation
Majority Element (#169) - Boyer-Moore voting
Missing Number (#268) - Math/XOR trick
Find Pivot Index (#724) - Prefix sum
Medium Problems
Product of Array Except Self (#238) - Prefix/suffix products
Find All Numbers Disappeared in an Array (#448) - In-place marking
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
Two Sum (#1) - Classic HashMap for pair finding
Contains Duplicate (#217) - HashSet basics
Valid Anagram (#242) - Character frequency map
Happy Number (#202) - HashSet for cycle detection
Intersection of Two Arrays (#349) - Set operations
Single Number (#136) - Bit manipulation vs hashing
Isomorphic Strings (#205) - Bijection with HashMap
Word Pattern (#290) - Pattern matching with HashMap
First Unique Character in a String (#387) - Frequency counting
Medium Problems
Group Anagrams (#49) - HashMap with string keys
Longest Consecutive Sequence (#128) - HashSet for O(n) solution
Subarray Sum Equals K (#560) - HashMap + prefix sum
Top K Frequent Elements (#347) - HashMap + bucket sort
LRU Cache (#146) - HashMap + Doubly Linked List
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
Move Zeroes (#283) - Basic two pointer
Remove Duplicates from Sorted Array (#26) - In-place manipulation
Merge Sorted Array (#88) - Two pointer merge
Valid Palindrome (#125) - Two pointer from ends
Reverse String (#344) - Two pointer swap
Two Sum II - Input Array Is Sorted (#167) - Two pointer on sorted
Intersection of Two Arrays II (#350) - Two pointer intersection
Medium Problems
3Sum (#15) - Three pointers
Container With Most Water (#11) - Greedy two pointer
Sort Colors (#75) - Dutch flag problem
Remove Duplicates from Sorted Array II (#80) - Two pointer with count
3Sum Closest (#16) - Three pointer variant
Linked Lists (10 problems)
Master pointer manipulation and understand the elegance of recursive solutions.
Easy Problems
Reverse Linked List (#206) - Fundamental operation
Merge Two Sorted Lists (#21) - Two pointer merge
Linked List Cycle (#141) - Floyd's cycle detection
Palindrome Linked List (#234) - Fast/slow pointer
Remove Duplicates from Sorted List (#83) - Traversal
Intersection of Two Linked Lists (#160) - Two pointer
Middle of the Linked List (#876) - Fast/slow pointer
Medium Problems
Remove Nth Node From End of List (#19) - Two pointer with gap
Add Two Numbers (#2) - Linked list arithmetic
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
Valid Parentheses (#20) - Classic stack
Implement Queue using Stacks (#232) - Stack manipulation
Backspace String Compare (#844) - Stack simulation
Next Greater Element I (#496) - Monotonic stack intro
Min Stack (#155) - Stack with min operation
Medium Problems
Evaluate Reverse Polish Notation (#150) - Expression evaluation
Daily Temperatures (#739) - Monotonic stack
Decode String (#394) - Nested stack operations
Queues & Priority Queues (7 problems)
FIFO operations and heap-based priority management.
Easy Problems
Implement Stack using Queues (#225) - Queue manipulation
Number of Recent Calls (#933) - Queue basics
Last Stone Weight (#1046) - Max heap basics
KthLargest Element in a Stream (#703) - Min heap maintenance
Medium Problems
Kth Largest Element in an Array (#215) - Priority queue/quickselect
K Closest Points to Origin (#973) - Priority queue
Task Scheduler (#621) - Priority queue + greedy
Binary Trees (13 problems)
Tree traversals, recursive thinking, and structural properties.
Easy Problems
Maximum Depth of Binary Tree (#104) - Basic DFS/BFS
Invert Binary Tree (#226) - Tree manipulation
Same Tree (#100) - Tree comparison
Symmetric Tree (#101) - Mirror comparison
Binary Tree Inorder Traversal (#94) - Traversal
Path Sum (#112) - Root-to-leaf path
Minimum Depth of Binary Tree (#111) - BFS/DFS
Balanced Binary Tree (#110) - Height calculation
Diameter of Binary Tree (#543) - Path through node
Subtree of Another Tree (#572) - Tree matching
Medium Problems
Binary Tree Level Order Traversal (#102) - BFS layers
Validate Binary Search Tree (#98) - BST property
Binary Tree Right Side View (#199) - Level traversal
Binary Search Trees (6 problems)
Leverage BST properties for efficient searching and manipulation.
Easy Problems
Search in a Binary Search Tree (#700) - BST basics
Convert Sorted Array to Binary Search Tree (#108) - BST construction
Lowest Common Ancestor of a Binary Search Tree (#235) - BST properties
Range Sum of BST (#938) - BST traversal
Medium Problems
Kth Smallest Element in a BST (#230) - Inorder traversal
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
Flood Fill (#733) - Basic DFS/BFS
Island Perimeter (#463) - Grid traversal
Find if Path Exists in Graph (#1971) - Graph traversal
Medium Problems
Number of Islands (#200) - DFS/BFS on grid
Max Area of Island (#695) - DFS with counting
Rotting Oranges (#994) - Multi-source BFS
Course Schedule (#207) - Topological sort
Pacific Atlantic Water Flow (#417) - Multi-source DFS
Clone Graph (#133) - Graph traversal + copying
Word Search (#79) - DFS with backtracking
Binary Search (8 problems)
O(log n) searching and its creative applications beyond sorted arrays.
Easy Problems
Binary Search (#704) - Classic binary search
First Bad Version (#278) - Binary search application
Search Insert Position (#35) - Binary search variant
Sqrt(x) (#69) - Binary search on answer
Guess Number Higher or Lower (#374) - Interactive binary search
Medium Problems
Find Peak Element (#162) - Binary search on unsorted
Search in Rotated Sorted Array (#33) - Modified binary search
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
Squares of a Sorted Array (#977) - Two pointer sorting
Sort Array By Parity (#905) - Partition algorithm
Medium Problems
Majority Element II (#229) - Boyer-Moore extended
Merge Intervals (#56) - Sort + merge
Sort an Array (#912) - Implement sorting algorithm
Divide and Conquer (6 problems)
Breaking problems into smaller subproblems and combining solutions.
Easy Problems
Maximum Subarray (#53) - Can use D&C approach
Majority Element (#169) - Can use D&C approach
Merge Two Sorted Lists (#21) - Base for merge sort
Medium Problems
Sort List (#148) - Merge sort on linked list
Kth Largest Element in an Array (#215) - Quickselect
Search a 2D Matrix II (#240) - D&C on matrix
Greedy (8 problems)
Making locally optimal choices to reach global optimum.
Easy Problems
Assign Cookies (#455) - Basic greedy
Maximum Units on a Truck (#1710) - Greedy sorting
Can Place Flowers (#605) - Greedy placement
Lemonade Change (#860) - Greedy change-making
Medium Problems
Jump Game (#55) - Greedy reachability
Jump Game II (#45) - Greedy optimization
Gas Station (#134) - Greedy circular array
Meeting Rooms II (#253) - Interval scheduling
Backtracking (8 problems)
Systematic exploration of solution space with pruning.
Easy Problems
Letter Case Permutation (#784) - Basic backtracking
Binary Tree Paths (#257) - Tree backtracking
Medium Problems
Combinations (#77) - Classic backtracking
Permutations (#46) - Permutation generation
Subsets (#78) - Subset generation
Generate Parentheses (#22) - Recursive generation
Hard Problems (Essential Classics)
N-Queens (#51) - Classic constraint satisfaction
Sudoku Solver (#37) - Constraint propagation