Skip to content

Anamicca23/Leetcode-for-DSA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3,512 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📘 Leetcode-for-DSA

A curated collection of LeetCode solutions for mastering Data Structures & Algorithms
Built with ❤️ using LeetHub | Track. Solve. Grow.


📂 Structure

Each folder is named after the LeetCode problem:

📁 0001-two-sum/
┣ 📄 solution.cpp
┣ 📄 solution.java
┗ 📄 solution.py

Problems are sorted by difficulty and topic (Easy / Medium / Hard).


🔧 Tech Stack

  • 💻 Languages: C++, Java, Python
  • 🔁 Sync Tool: LeetHub
  • 📚 Platform: LeetCode

🚀 How to Use

# Step 1: Fork this repo
# Step 2: Clone it locally
git clone https://github.com/Anamicca23/Leetcode-for-DSA.git

# Step 3: Add your own solutions following the naming convention

ARRAY

Easy Level ❤️

📚 Array - Two Pointer, Hash Table
# No. Title Link Tags Level
1 26 Remove Duplicates from Sorted Array LC Array, Two Pointers Easy
2 27 Remove Element LC Array, Two Pointers Easy
3 88 Merge Sorted Array LC Array, Two Pointers, Sorting Easy
4 170 Two Sum III - Data Structure Design LC Array, Hash Table, Two Pointers Easy
5 283 Move Zeroes LC Array, Two Pointers Easy
6 349 Intersection of Two Arrays LC Array, Hash Table, Two Pointers Easy
7 350 Intersection of Two Arrays II LC Array, Hash Table, Two Pointers Easy
8 455 Assign Cookies LC Array, Two Pointers, Greedy Easy
9 821 Shortest Distance to a Character LC Array, Two Pointers, String Easy
10 832 Flipping an Image LC Array, Two Pointers, Matrix Easy
11 905 Sort Array By Parity LC Array, Two Pointers, Sorting Easy
12 922 Sort Array By Parity II LC Array, Two Pointers, Sorting Easy
13 942 DI String Match LC Array, Two Pointers, String Easy
14 977 Squares of a Sorted Array LC Array, Two Pointers, Sorting Easy
15 1089 Duplicate Zeros LC Array, Two Pointers Easy
16 1346 Check If N and Its Double Exist LC Array, Hash Table, Two Pointers Easy
17 1385 Find the Distance Value Between Two Arrays LC Array, Two Pointers, Binary Search Easy
18 1826 Faulty Sensor LC Array, Two Pointers Easy
19 2108 Find First Palindromic String in the Array LC Array, Two Pointers, String Easy
20 2367 Number of Arithmetic Triplets LC Array, Hash Table, Two Pointers Easy
21 2441 Largest Positive Integer That Exists With Its Negative LC Array, Hash Table, Two Pointers Easy
22 2465 Number of Distinct Averages LC Array, Hash Table, Two Pointers Easy
23 2511 Maximum Enemy Forts That Can Be Captured LC Array, Two Pointers Easy
24 2540 Minimum Common Value LC Array, Hash Table, Two Pointers Easy
25 2562 Find the Array Concatenation Value LC Array, Two Pointers, Simulation Easy
26 2570 Merge Two 2D Arrays by Summing Values LC Array, Hash Table, Two Pointers Easy
📚 Array - Sliding Window
# No. Title Link Tags Level
1 1456 Maximum Number of Vowels in a Substring of Given Length LC String, Sliding Window Easy
2 1652 Defuse the Bomb LC Array, Sliding Window Easy
3 1984 Minimum Difference Between Highest and Lowest of K Scores LC Array, Sliding Window, Sorting Easy
4 2024 Maximize the Confusion of an Exam LC String, Sliding Window, Binary Search Easy
5 2270 Number of Ways to Split Array LC Array, Sliding Window, Prefix Sum Easy

Medium Level ❤️❤️❤️

📘 Array - Two Pointer, Sorting, Binary Search, Greedy
# No. Title LC Tags Level
1 11 Container With Most Water LC Array, Two Pointers, Greedy Medium
2 15 3Sum LC Array, Two Pointers, Sorting Medium
3 16 3Sum Closest LC Array, Two Pointers, Sorting Medium
4 18 4Sum LC Array, Two Pointers, Sorting Medium
5 31 Next Permutation LC Array, Two Pointers Medium
6 75 Sort Colors LC Array, Two Pointers, Sorting Medium
7 80 Remove Duplicates from Sorted Array II LC Array, Two Pointers Medium
8 167 Two Sum II - Input Array Is Sorted LC Array, Two Pointers, Binary Search Medium
9 189 Rotate Array LC Array, Math, Two Pointers Medium
10 244 Shortest Word Distance II LC Array, Hash Table, Two Pointers Medium
11 251 Flatten 2D Vector LC Array, Two Pointers, Design Medium
12 253 Meeting Rooms II LC Array, Two Pointers, Greedy Medium
13 259 3Sum Smaller LC Array, Two Pointers, Binary Search Medium
14 287 Find the Duplicate Number LC Array, Two Pointers, Binary Search Medium
15 360 Sort Transformed Array LC Array, Math, Two Pointers Medium
16 457 Circular Array Loop LC Array, Hash Table, Two Pointers Medium
17 475 Heaters LC Array, Two Pointers, Binary Search Medium
18 522 Longest Uncommon Subsequence II LC Array, Hash Table, Two Pointers Medium
19 524 Longest Word in Dictionary through Deleting LC Array, Two Pointers, String Medium
20 532 K-diff Pairs in an Array LC Array, Hash Table, Two Pointers Medium
21 581 Shortest Unsorted Continuous Subarray LC Array, Two Pointers, Stack Medium
22 611 Valid Triangle Number LC Array, Two Pointers, Binary Search Medium
23 658 Find K Closest Elements LC Array, Two Pointers, Binary Search Medium
24 723 Candy Crush LC Array, Two Pointers, Matrix Medium
25 795 Number of Subarrays with Bounded Maximum LC Array, Two Pointers Medium
26 809 Expressive Words LC Array, Two Pointers, String Medium
27 825 Friends Of Appropriate Ages LC Array, Two Pointers, Binary Search Medium
28 826 Most Profit Assigning Work LC Array, Two Pointers, Binary Search Medium
29 845 Longest Mountain in Array LC Array, Two Pointers Medium
30 870 Advantage Shuffle LC Array, Two Pointers, Greedy Medium
31 881 Boats to Save People LC Array, Two Pointers, Greedy Medium
32 923 3Sum With Multiplicity LC Array, Hash Table, Two Pointers Medium
33 948 Bag of Tokens LC Array, Two Pointers, Greedy Medium
34 969 Pancake Sorting LC Array, Two Pointers, Greedy Medium
35 986 Interval List Intersections LC Array, Two Pointers Medium
36 1040 Moving Stones Until Consecutive II LC Array, Math, Two Pointers Medium
37 1048 Longest String Chain LC Array, Hash Table, Two Pointers Medium
38 1229 Meeting Scheduler LC Array, Two Pointers, Sorting Medium
39 1471 The k Strongest Values in an Array LC Array, Sorting Medium
40 1498 Subsequences Satisfying the Given Sum Condition LC Array, Two Pointers, Binary Search Medium
41 1508 Range Sum of Sorted Subarray Sums LC Array, Two Pointers, Binary Search Medium
42 1570 Dot Product of Two Sparse Vectors LC Array, Hash Table, Two Pointers Medium
43 1574 Shortest Subarray to be Removed to Make Array Sorted LC Array, Two Pointers, Binary Search Medium
44 1577 Square Equals Product of Two Numbers LC Array, Hash Table, Math Medium
45 1679 Max Number of K-Sum Pairs LC Array, Hash Table, Two Pointers Medium
46 1712 Ways to Split Array Into Three Subarrays LC Array, Two Pointers, Binary Search Medium
47 1813 Sentence Similarity III LC Array, Two Pointers, String Medium
48 1855 Max Distance Between a Pair of Values LC Array, Two Pointers, Binary Search Medium
49 1861 Rotating the Box LC Array, Two Pointers, Matrix Medium
50 1868 Product of Two Run-Length Encoded Arrays LC Array, Two Pointers Medium
51 1877 Minimize Maximum Pair Sum in Array LC Array, Two Pointers, Greedy Medium
52 2105 Watering Plants II LC Array, Two Pointers, Simulation Medium
53 2149 Rearrange Array Elements by Sign LC Array, Two Pointers, Simulation Medium
54 2161 Partition Array According to Given Pivot LC Array, Two Pointers, Simulation Medium
55 2300 Successful Pairs of Spells and Potions LC Array, Two Pointers, Binary Search Medium
56 2332 Latest Time to Catch a Bus LC Array, Two Pointers, Binary Search Medium
57 2406 Divide Intervals Into Min Number of Groups LC Array, Two Pointers, Greedy Medium
58 2410 Max Matching of Players With Trainers LC Array, Two Pointers, Greedy Medium
59 2422 Merge Operations to Turn Array Into Palindrome LC Array, Two Pointers, Greedy Medium
60 2462 Total Cost to Hire K Workers LC Array, Two Pointers Medium
61 2491 Divide Players Into Teams of Equal Skill LC Array, Hash Table, Two Pointers Medium
62 2563 Count the Number of Fair Pairs LC Array, Two Pointers, Binary Search Medium
63 2576 Max Number of Marked Indices LC Array, Two Pointers, Binary Search Medium
64 2592 Maximize Greatness of an Array LC Array, Two Pointers, Greedy Medium
📘 Array - Sliding Window, Binary Search, Hash Table
# No. Title LC Link Tags Level
1 209 Minimum Size Subarray Sum LC Array, Binary Search, Sliding Window Medium
2 487 Max Consecutive Ones II LC Array, DP, Sliding Window Medium
3 658 Find K Closest Elements LC Array, Two Pointers, Binary Search Medium
4 713 Subarray Product Less Than K LC Array, Sliding Window Medium
5 718 Maximum Length of Repeated Subarray LC Array, Binary Search Medium
6 904 Fruit Into Baskets LC Array, Hash Table, Sliding Window Medium
7 930 Binary Subarrays With Sum LC Array, Hash Table, Sliding Window Medium
8 978 Longest Turbulent Subarray LC Array, DP, Sliding Window Medium
9 1004 Max Consecutive Ones III LC Array, Binary Search, Sliding Window Medium
10 1031 Max Sum of Two Non-Overlapping Subarrays LC Array, DP, Sliding Window Medium
11 1052 Grumpy Bookstore Owner LC Array, Sliding Window Medium
12 1151 Min Swaps to Group All 1's Together LC Array, Sliding Window Medium
13 1248 Count Number of Nice Subarrays LC Array, Hash Table, Math Medium
14 1343 Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold LC Array, Sliding Window Medium
15 1423 Max Points You Can Obtain from Cards LC Array, Sliding Window, Prefix Sum Medium
16 1438 Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit LC Array, Queue, Sliding Window Medium
17 1477 Two Non-overlapping Subarrays With Target Sum LC Array, Hash Table, Binary Search Medium
18 1493 Longest Subarray of 1's After Deleting One Element LC Array, DP, Sliding Window Medium
19 1658 Min Operations to Reduce X to Zero LC Array, Hash Table, Binary Search Medium
20 1695 Maximum Erasure Value LC Array, Hash Table, Sliding Window Medium
21 1696 Jump Game VI LC Array, DP, Queue Medium
22 1838 Frequency of the Most Frequent Element LC Array, Binary Search, Greedy Medium
23 1852 Distinct Numbers in Each Subarray LC Array, Hash Table, Sliding Window Medium
24 1918 Kth Smallest Subarray Sum LC Array, Binary Search, Sliding Window Medium
25 2090 K Radius Subarray Averages LC Array, Sliding Window Medium
26 2107 Unique Flavors After Sharing K Candies LC Array, Hash Table, Sliding Window Medium
27 2134 Minimum Swaps to Group All 1's Together II LC Array, Sliding Window Medium
28 2260 Minimum Consecutive Cards to Pick Up LC Array, Hash Table, Sliding Window Medium
29 2401 Longest Nice Subarray LC Array, Bit Manipulation, Sliding Window Medium
30 2411 Smallest Subarrays With Max Bitwise OR LC Array, Binary Search, Bit Manipulation Medium
31 2461 Maximum Sum of Distinct Subarrays of Length K LC Array, Hash Table, Sliding Window Medium
32 2537 Count the Number of Good Subarrays LC Array, Hash Table, Sliding Window Medium
33 2555 Maximize Win From Two Segments LC Array, Binary Search, Sliding Window Medium
34 2653 Sliding Subarray Beauty LC Array, Hash Table, Sliding Window Medium

Hard Level ❤️❤️❤️❤️❤️

📚 Array - Two Pointer, Binary Search
# No. Title Link Tags Level
1 42 Trapping Rain Water LC Array, Two Pointers, DP, Stack Hard
2 719 Find K-th Smallest Pair Distance LC Array, Two Pointers, Binary Search, Sorting Hard
3 1537 Get the Maximum Score LC Array, Two Pointers, DP, Greedy Hard
4 1755 Closest Subsequence Sum LC Array, Two Pointers, Bit Manipulation Hard
5 1793 Maximum Score of a Good Subarray LC Array, Two Pointers, Binary Search, Stack Hard
6 2035 Partition Array Into Two Arrays to Minimize Sum Difference LC Array, Two Pointers, Binary Search, Bit Manipulation Hard
7 2234 Maximum Total Beauty of the Gardens LC Array, Two Pointers, Binary Search, Greedy Hard
📚 Array - Sliding Window, Hash Table, Binary Search
# No. Title Link Tags Level
1 220 Contains Duplicate III LC Array, Sliding Window, Sorting, Ordered Set Hard
2 239 Sliding Window Maximum LC Array, Queue, Sliding Window, Monotonic Queue Hard
3 480 Sliding Window Median LC Array, Hash Table, Sliding Window, Heap Hard
4 632 Smallest Range Covering Elements from K Lists LC Array, Hash Table, Greedy, Sliding Window, Heap Hard
5 683 K Empty Slots LC Array, Sliding Window, Sorting, Ordered Set Hard
6 862 Shortest Subarray with Sum at Least K LC Array, Binary Search, Queue, Sliding Window Hard
7 992 Subarrays with K Different Integers LC Array, Hash Table, Sliding Window Hard
8 995 Minimum Number of K Consecutive Bit Flips LC Array, Bit Manipulation, Queue, Sliding Window Hard
9 1425 Constrained Subsequence Sum LC Array, DP, Queue, Sliding Window Hard
10 1499 Max Value of Equation LC Array, Queue, Sliding Window, Monotonic Queue Hard
11 1610 Maximum Number of Visible Points LC Array, Math, Geometry, Sorting, Sliding Window Hard
12 1703 Minimum Adjacent Swaps for K Consecutive Ones LC Array, Math, Greedy, Sliding Window Hard
13 2106 Maximum Fruits Harvested After at Most K Steps LC Array, Binary Search, Sliding Window, Prefix Sum Hard
14 2302 Count Subarrays With Score Less Than K LC Array, Binary Search, Sliding Window, Prefix Sum Hard
15 2398 Maximum Number of Robots Within Budget LC Array, Binary Search, Queue, Sliding Window Hard
16 2444 Count Subarrays With Fixed Bounds LC Array, Queue, Sliding Window, Monotonic Queue Hard
17 2524 Maximum Frequency Score of a Subarray LC Array, Hash Table, Math, Sliding Window Hard
18 2528 Maximize the Minimum Powered City LC Array, Binary Search, Greedy, Sliding Window Hard

TREES AND GRAPHS

📚 Trees and Graphs
# No. Title Link Tags Level
1 785 Is Graph Bipartite? LC DFS, BFS, Graph, Union Find Medium
2 823 Binary Trees with Factors LC Array, Hash Table, DP Medium
3 130 Surrounded Regions LC Array, DFS, BFS, Matrix, Union Find Medium
4 752 Open the Lock LC Array, Hash Table, String, BFS Medium
5 802 Find Eventual Safe States LC DFS, BFS, Graph, Topological Sort Medium
6 863 All Nodes Distance K in Binary Tree LC Tree, DFS, BFS, Binary Tree Medium
7 924 Minimize Malware Spread LC Array, Hash Table, Graph, Union Find Hard
8 1306 Jump Game III LC Array, DFS, BFS Medium
9 1489 Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree LC Union Find, Graph, MST Hard
10 1617 Count Subtrees with Max Distance Between Cities LC Tree, DFS, Bit Manipulation Hard
11 1766 Tree of Coprimes LC Math, Tree, DFS, Number Theory Hard
12 1928 Minimum Cost to Reach Destination in Time LC Array, DP, Graph Hard
13 2101 Detonate the Maximum Bombs LC Array, Math, DFS, BFS, Graph, Geometry Medium
14 2322 Minimum Score After Removals on a Tree LC Tree, DFS, Bit Manipulation Hard
15 2440 Create Components with Same Value LC Array, Math, Tree, DFS, Graph Hard
16 2493 Divide Nodes Into the Maximum Number of Groups LC BFS, Union Find, Graph Hard
17 2509 Cycle Length Queries in a Tree LC Tree, DFS, Binary Lifting Hard
18 2646 Minimize the Total Price of the Trips LC Array, DFS, Tree, DP, Binary Tree Hard
19 685 Redundant Connection II LC DFS, Graph, Union Find, Tree Hard
📚 BFS / DFS (Shortest Paths)
# No. Title Link Tags Level
1 433 Minimum Genetic Mutation LC Hash Table, String, BFS Medium
2 815 Bus Routes LC Array, Hash Table, BFS Hard
3 1091 Shortest Path in Binary Matrix LC Array, BFS, Matrix Medium
4 1786 Number of Restricted Paths from First to Last Node LC Graph, DFS, BFS, Heap, DP Medium
5 1926 Nearest Exit from Entrance in Maze LC Array, BFS, Matrix Medium
6 2503 Maximum Number of Points from Grid Queries LC Array, BFS, Graph, Sorting, Heap Hard
7 2577 Minimum Time to Visit a Cell in a Grid LC Array, BFS, Matrix, Heap Hard
📚 Hashmaps
# No. Title Link Tags Level
1 1657 Determine if Two Strings Are Close LC Hash Table, String, Sorting Medium
2 1912 Design Movie Rental System LC Array, Hash Table, Design, Heap, Ordered Set Hard
3 2718 Sum of Matrix After Queries LC Array, Hash Table, Matrix Medium
📚 Binary Trees
# No. Title Link Tags Level
1 513 Find Bottom Left Tree Value LC Tree, DFS, BFS, Binary Tree Medium
2 623 Add One Row to Tree LC Tree, DFS, BFS, Binary Tree Medium
3 1080 Insufficient Nodes in Root to Leaf Paths LC Tree, DFS, Binary Tree Medium
4 1104 Path in Zigzag Labelled Binary Tree LC Math, Tree, Binary Tree Medium
5 1145 Binary Tree Coloring Game LC Tree, DFS, Binary Tree Medium
6 1367 Linked List in Binary Tree LC Linked List, Tree, DFS, Binary Tree Medium
7 1530 Number of Good Leaf Nodes Pairs LC Tree, DFS, Binary Tree Medium
8 2096 Step-by-Step Directions from a Binary Tree Node to Another LC String, Tree, DFS, Binary Tree Medium

BITWISE OPERATIONS

📚 Bitwise Operations
# No. Title Link Tags Level
1 1404 Number of Steps to Reduce a Number in Binary Representation to One LC String, Bit Manipulation Medium
2 1738 Find Kth Largest XOR Coordinate Value LC Array, Bit Manipulation, Prefix Sum, Heap Medium
3 2683 Neighboring Bitwise XOR LC Array, Bit Manipulation Medium
4 2835 Minimum Operations to Form Subsequence with Target Sum LC Array, Bit Manipulation, Greedy Hard

RECURSION

📚 Recursion
# No. Title Link Tags Level
1 842 Split Array into Fibonacci Sequence LC String, Backtracking, Greedy Medium
2 967 Numbers with Same Consecutive Differences LC DFS, BFS, Backtracking Medium
3 1601 Maximum Number of Achievable Transfer Requests LC Array, Backtracking, Bit Manipulation, Enumeration Hard
4 2698 Find the Punishment Number of an Integer LC Math, Backtracking Medium

SLIDING WINDOW

📚 Sliding Window (Additional)
# No. Title Link Tags Level
1 2747 Count Zero Request Servers LC Array, Hash Table, Binary Search, Sliding Window Medium
2 2762 Continuous Subarrays LC Array, Sliding Window, Queue, Ordered Set, Heap Medium
3 2781 Length of the Longest Valid Substring LC Array, Hash Table, String, Sliding Window Hard

STACK

📚 Stack
# No. Title Link Tags Level
1 84 Largest Rectangle in Histogram LC Array, Stack, Monotonic Stack Hard
2 735 Asteroid Collision LC Array, Stack, Simulation Medium
3 907 Sum of Subarray Minimums LC Array, Stack, DP, Monotonic Stack Medium
4 1209 Remove All Adjacent Duplicates in String II LC String, Stack Medium
5 1944 Number of Visible People in a Queue LC Array, Stack, Monotonic Stack Hard
6 2334 Subarray with Elements Greater Than Varying Threshold LC Array, Stack, Union Find, Monotonic Stack Hard
7 2751 Robot Collisions LC Array, Stack, Sorting, Simulation Hard
8 2818 Apply Operations to Maximize Score LC Array, Math, Stack, Greedy, Monotonic Stack Hard
9 2866 Beautiful Towers II LC Array, Stack, Monotonic Stack Medium

DYNAMIC PROGRAMMING

📚 Dynamic Programming
# No. Title Link Tags Level
1 354 Russian Doll Envelopes LC Array, Binary Search, DP, Sorting Hard
2 552 Student Attendance Record II LC DP Hard
3 673 Number of Longest Increasing Subsequence LC Array, Binary Search, DP, Segment Tree Medium
4 712 Minimum ASCII Delete Sum for Two Strings LC String, DP Medium
5 935 Knight Dialer LC DP Medium
6 956 Tallest Billboard LC Array, DP Hard
7 1027 Longest Arithmetic Subsequence LC Array, Hash Table, Binary Search, DP Medium
8 1218 Longest Arithmetic Subsequence of Given Difference LC Array, Hash Table, DP Medium
9 1220 Count Vowels Permutation LC DP, Math Hard
10 1335 Minimum Difficulty of a Job Schedule LC Array, DP Hard
11 1575 Count All Possible Routes LC Array, DP, Memoization Hard
12 1749 Maximum Absolute Sum of Any Subarray LC Array, DP Medium
13 1751 Maximum Number of Events That Can Be Attended II LC Array, Binary Search, DP, Sorting Hard
14 1824 Minimum Sideway Jumps LC Array, DP, Greedy Medium
15 1911 Maximum Alternating Subsequence Sum LC Array, DP, Greedy Medium
16 2746 Decremental String Concatenation LC String, DP Medium
17 2763 Sum of Imbalance Numbers of All Subarrays LC Array, Hash Table, Counting Hard
📚 Bitmasking DP
# No. Title Link Tags Level
1 1178 Number of Valid Words for Each Puzzle LC Array, Hash Table, String, Bit Manipulation, Trie Hard
2 1269 Number of Ways to Stay in the Same Place After Some Steps LC DP Hard
3 1434 Number of Ways to Wear Different Hats to Each Other LC Array, DP, Bit Manipulation Hard
4 1542 Find Longest Awesome Substring LC Hash Table, String, Bit Manipulation Hard
5 1799 Maximize Score After N Operations LC Array, Math, DP, Backtracking, Bit Manipulation Hard
6 1986 Minimum Number of Work Sessions to Finish the Tasks LC Array, DP, Backtracking, Bit Manipulation Medium
7 2002 Maximum Product of the Length of Two Palindromic Subsets LC Array, String, DP, Bit Manipulation Hard
8 2741 Special Permutations LC Array, DP, Bit Manipulation Medium
📚 Digit DP
# No. Title Link Tags Level
1 600 Non-negative Integers Without Consecutive Ones LC DP, Bit Manipulation Hard
2 2376 Count Special Integers LC Math, DP Hard
3 2719 Count of Integers LC Math, String, DP Hard
4 2801 Count Stepping Numbers in Range LC Math, String, DP Hard

LINKED LISTS

📚 Linked Lists
# No. Title Link Tags Level
1 92 Reverse Linked List II LC Linked List Medium
2 725 Split Linked List in Parts LC Linked List Medium
3 1669 Merge In Between Linked Lists LC Linked List Medium
4 2095 Delete the Middle Node of a Linked List LC Linked List, Two Pointers Medium
5 2487 Remove Nodes from Linked List LC Linked List, Stack, Recursion Medium

SUFFIX AND PREFIX ARRAY

📚 Suffix and Prefix Array
# No. Title Link Tags Level
1 456 132 Pattern LC Array, Binary Search, Stack, Monotonic Stack Medium
2 768 Max Chunks To Make Sorted II LC Array, Stack, Greedy, Sorting, Monotonic Stack Hard
3 1653 Minimum Deletions to Make String Balanced LC String, Stack, DP Medium
4 2017 Grid Game LC Array, Matrix, Prefix Sum Medium
5 2448 Minimum Cost to Make Array Equal LC Array, Binary Search, Prefix Sum Medium
6 2483 Minimum Penalty for a Shop LC String, Prefix Sum Medium
7 2780 Minimum Index of a Valid Split LC Array, Hash Table, Sorting Medium

DSU (DISJOINT SET UNION)

📚 DSU (Union-Find)
# No. Title Link Tags Level
1 721 Accounts Merge LC Array, Hash Table, String, DFS, BFS, DSU Medium
2 827 Making a Large Island LC Array, DFS, BFS, Union Find, Matrix Hard
3 990 Satisfiability of Equality Equations LC Array, String, Graph, Union Find Medium
4 1627 Graph Connectivity with Threshold LC Array, Math, Union Find Hard
5 2076 Process Restricted Friend Requests LC Array, Union Find Hard

BINARY SEARCH

📚 Binary Search (Additional)
# No. Title Link Tags Level
1 410 Split Array Largest Sum LC Array, Binary Search, DP, Greedy Hard
2 668 Kth Smallest Number in Multiplication Table LC Math, Binary Search Hard
3 1146 Snapshot Array LC Array, Hash Table, Binary Search, Design Medium
4 1760 Minimum Limit of Balls in a Bag LC Array, Binary Search Medium
5 1898 Maximum Number of Removable Characters LC Array, String, Binary Search Medium
6 2080 Range Frequency Queries LC Array, Hash Table, Binary Search, Design Medium

SORTING

📚 Sorting
# No. Title Link Tags Level
1 435 Non-overlapping Intervals LC Array, Greedy, Sorting Medium
2 452 Minimum Number of Arrows to Burst Balloons LC Array, Greedy, Sorting Medium
3 786 K-th Smallest Prime Fraction LC Array, Binary Search, Sorting, Heap Medium
4 1847 Closest Room LC Array, Binary Search, Sorting Hard
5 1851 Minimum Interval to Include Each Query LC Array, Binary Search, Greedy, Sorting, Heap Hard
6 2551 Put Marbles in Bags LC Array, Greedy, Sorting, Heap Hard
7 2731 Movement of Robots LC Array, Math, Prefix Sum, Sorting Medium

STRING

📚 String
# No. Title Link Tags Level
1 214 Shortest Palindrome LC String, Rolling Hash, String Matching Hard
2 1044 Longest Duplicate Substring LC String, Binary Search, Rolling Hash, Suffix Array Hard
3 1147 Longest Chunked Palindrome Decomposition LC String, Two Pointers, Greedy, Hashing Hard
4 1668 Maximum Repeating Substring LC String, DP, String Matching Easy
5 2223 Sum of Scores of Built Strings LC String, Binary Search, Rolling Hash, Z-Algorithm Hard
6 2430 Maximum Deletions on a String LC String, DP, Rolling Hash Hard
7 2734 Lexicographically Smallest String After Substring Operation LC String, Greedy Medium

COUNTING

📚 Counting
# No. Title Link Tags Level
1 828 Count Unique Characters of All Substrings of a Given String LC Hash Table, String, DP Hard
2 1588 Sum of All Odd Length Subarrays LC Array, Math, Prefix Sum Easy
3 2514 Count Anagrams LC Hash Table, Math, String, Combinatorics Hard

LINE SWEEP

📚 Line Sweep
# No. Title Link Tags Level
1 732 My Calendar III LC Binary Search, Design, Segment Tree, Ordered Set Hard
2 1943 Describe the Painting LC Array, Hash Table, Sorting, Prefix Sum Medium
3 2251 Number of Flowers in Full Bloom LC Array, Hash Table, Binary Search, Sorting, Prefix Sum Hard
4 2779 Maximum Beauty of an Array After Applying Operation LC Array, Binary Search, Sliding Window, Sorting Medium

RE-ROOTING

📚 Re-rooting
# No. Title Link Tags Level
1 310 Minimum Height Trees LC DFS, BFS, Graph, Topological Sort Medium
2 2538 Difference Between Maximum and Minimum Price Sum LC Array, Tree, DFS Hard
3 2581 Count Number of Possible Root Nodes LC Tree, DFS, Hashing Hard

TRIE

📚 Trie
# No. Title Link Tags Level
1 745 Prefix and Suffix Search LC Design, Trie, Hash Table, String Hard
2 1938 Maximum Genetic Difference Query LC Array, String, Bit Manipulation, Trie Hard
3 2416 Sum of Prefix Scores of Strings LC Array, String, Trie, Counting Hard

✅ Best Practices

  • Keep filenames clean (solution.cpp, solution.py)
  • Add comments where necessary
  • Group problems by topics (optional but encouraged)

🤝 Contributing

Want to help expand this repository?

  1. Fork it 🍴
  2. Create your feature branch (git checkout -b new-solution)
  3. Commit your changes (git commit -m 'Added XYZ problem')
  4. Push to the branch (git push origin new-solution)
  5. Open a PR 🚀

🌟 Support & Recognition

If this project helps you:

  • Star the repo
  • 🔁 Share it with peers preparing for coding interviews
  • 🧠 Keep coding and contribute back!

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.


👤 About

Made with ☕ and code by Anamicca23

Let's crack those coding interviews one problem at a time!


LeetCode Topics

Array

Problem Name Difficulty
0048-rotate-image Medium
0396-rotate-function Medium
0874-walking-robot-simulation Medium
1536-minimum-swaps-to-arrange-a-binary-grid Medium
1559-detect-cycles-in-2d-grid Medium
1582-special-positions-in-a-binary-matrix Easy
1594-maximum-non-negative-product-in-a-matrix Medium
1722-minimize-hamming-distance-after-swap-operations Medium
1727-largest-submatrix-with-rearrangements Medium
1848-minimum-distance-to-the-target-element Easy
1855-maximum-distance-between-a-pair-of-values Medium
1861-rotating-the-box Medium
1878-get-biggest-three-rhombus-sums-in-a-grid Medium
1886-determine-whether-matrix-can-be-obtained-by-rotation Easy
1914-cyclically-rotating-a-grid Medium
1980-find-unique-binary-string Medium
2078-two-furthest-houses-with-different-colors Easy
2452-words-within-two-edits-of-dictionary Medium
2463-minimum-total-distance-traveled Hard
2515-shortest-distance-to-target-string-in-a-circular-array Easy
2573-find-the-string-with-lcp Hard
2615-sum-of-distances Medium
2751-robot-collisions Hard
2906-construct-product-matrix Medium
2946-matrix-similarity-after-cyclic-shifts Easy
3070-count-submatrices-with-top-left-element-and-sum-less-than-k Medium
3212-count-submatrices-with-equal-frequency-of-x-and-y Medium
3296-minimum-number-of-seconds-to-make-mountain-height-zero Medium
3418-maximum-amount-of-money-robot-can-earn Medium
3464-maximize-the-distance-between-points-on-a-square Hard
3488-closest-equal-element-queries Medium
3546-equal-sum-grid-partition-i Medium
3548-equal-sum-grid-partition-ii Hard
3567-minimum-absolute-difference-in-sliding-submatrix Medium
3629-minimum-jumps-to-reach-end-via-prime-teleportation Medium
3643-flip-square-submatrix-vertically Easy
3653-xor-after-range-multiplication-queries-i Medium
3655-xor-after-range-multiplication-queries-ii Hard
3660-jump-game-ix Medium
3661-maximum-walls-destroyed-by-robots Hard
3740-minimum-distance-between-three-equal-elements-i Easy
3741-minimum-distance-between-three-equal-elements-ii Medium
3742-maximum-path-score-in-a-grid Medium
3761-minimum-absolute-distance-between-mirror-pairs Medium

Greedy

Problem Name Difficulty
1536-minimum-swaps-to-arrange-a-binary-grid Medium
1727-largest-submatrix-with-rearrangements Medium
2078-two-furthest-houses-with-different-colors Easy
2573-find-the-string-with-lcp Hard
3296-minimum-number-of-seconds-to-make-mountain-height-zero Medium
3474-lexicographically-smallest-generated-string Hard
3600-maximize-spanning-tree-stability-with-upgrades Hard

Matrix

Problem Name Difficulty
0048-rotate-image Medium
1536-minimum-swaps-to-arrange-a-binary-grid Medium
1559-detect-cycles-in-2d-grid Medium
1582-special-positions-in-a-binary-matrix Easy
1594-maximum-non-negative-product-in-a-matrix Medium
1727-largest-submatrix-with-rearrangements Medium
1861-rotating-the-box Medium
1878-get-biggest-three-rhombus-sums-in-a-grid Medium
1886-determine-whether-matrix-can-be-obtained-by-rotation Easy
1914-cyclically-rotating-a-grid Medium
2573-find-the-string-with-lcp Hard
2906-construct-product-matrix Medium
2946-matrix-similarity-after-cyclic-shifts Easy
3070-count-submatrices-with-top-left-element-and-sum-less-than-k Medium
3212-count-submatrices-with-equal-frequency-of-x-and-y Medium
3418-maximum-amount-of-money-robot-can-earn Medium
3546-equal-sum-grid-partition-i Medium
3548-equal-sum-grid-partition-ii Hard
3567-minimum-absolute-difference-in-sliding-submatrix Medium
3643-flip-square-submatrix-vertically Easy
3742-maximum-path-score-in-a-grid Medium

String

Problem Name Difficulty
0657-robot-return-to-origin Easy
0796-rotate-string Easy
1320-minimum-distance-to-type-a-word-using-two-fingers Hard
1415-the-k-th-lexicographical-string-of-all-happy-strings-of-length-n Medium
1545-find-kth-bit-in-nth-binary-string Medium
1758-minimum-changes-to-make-alternating-binary-string Easy
1784-check-if-binary-string-has-at-most-one-segment-of-ones Easy
1888-minimum-number-of-flips-to-make-the-binary-string-alternating Medium
1980-find-unique-binary-string Medium
2075-decode-the-slanted-ciphertext Medium
2452-words-within-two-edits-of-dictionary Medium
2515-shortest-distance-to-target-string-in-a-circular-array Easy
2573-find-the-string-with-lcp Hard
2833-furthest-point-from-origin Easy
2839-check-if-strings-can-be-made-equal-with-operations-i Easy
2840-check-if-strings-can-be-made-equal-with-operations-ii Medium
3474-lexicographically-smallest-generated-string Hard

Recursion

Problem Name Difficulty
1545-find-kth-bit-in-nth-binary-string Medium

Simulation

Problem Name Difficulty
0657-robot-return-to-origin Easy
0874-walking-robot-simulation Medium
1545-find-kth-bit-in-nth-binary-string Medium
1914-cyclically-rotating-a-grid Medium
2069-walking-robot-simulation-ii Medium
2075-decode-the-slanted-ciphertext Medium
2751-robot-collisions Hard
2946-matrix-similarity-after-cyclic-shifts Easy
3653-xor-after-range-multiplication-queries-i Medium

Dynamic Programming

Problem Name Difficulty
0396-rotate-function Medium
0788-rotated-digits Medium
1320-minimum-distance-to-type-a-word-using-two-fingers Hard
1594-maximum-non-negative-product-in-a-matrix Medium
1888-minimum-number-of-flips-to-make-the-binary-string-alternating Medium
2463-minimum-total-distance-traveled Hard
2573-find-the-string-with-lcp Hard
3129-find-all-possible-stable-binary-arrays-i Medium
3130-find-all-possible-stable-binary-arrays-ii Hard
3418-maximum-amount-of-money-robot-can-earn Medium
3660-jump-game-ix Medium
3661-maximum-walls-destroyed-by-robots Hard
3742-maximum-path-score-in-a-grid Medium

Sliding Window

Problem Name Difficulty
1888-minimum-number-of-flips-to-make-the-binary-string-alternating Medium

Hash Table

Problem Name Difficulty
0874-walking-robot-simulation Medium
1980-find-unique-binary-string Medium
2615-sum-of-distances Medium
2840-check-if-strings-can-be-made-equal-with-operations-ii Medium
3488-closest-equal-element-queries Medium
3548-equal-sum-grid-partition-ii Hard
3629-minimum-jumps-to-reach-end-via-prime-teleportation Medium
3740-minimum-distance-between-three-equal-elements-i Easy
3741-minimum-distance-between-three-equal-elements-ii Medium
3761-minimum-absolute-distance-between-mirror-pairs Medium

Backtracking

Problem Name Difficulty
1415-the-k-th-lexicographical-string-of-all-happy-strings-of-length-n Medium
1980-find-unique-binary-string Medium

Prefix Sum

Problem Name Difficulty
1878-get-biggest-three-rhombus-sums-in-a-grid Medium
2615-sum-of-distances Medium
2906-construct-product-matrix Medium
3070-count-submatrices-with-top-left-element-and-sum-less-than-k Medium
3129-find-all-possible-stable-binary-arrays-i Medium
3130-find-all-possible-stable-binary-arrays-ii Hard
3212-count-submatrices-with-equal-frequency-of-x-and-y Medium
3546-equal-sum-grid-partition-i Medium
3548-equal-sum-grid-partition-ii Hard

Bit Manipulation

Problem Name Difficulty
1009-complement-of-base-10-integer Easy

Binary Search

Problem Name Difficulty
1855-maximum-distance-between-a-pair-of-values Medium
3296-minimum-number-of-seconds-to-make-mountain-height-zero Medium
3464-maximize-the-distance-between-points-on-a-square Hard
3488-closest-equal-element-queries Medium
3600-maximize-spanning-tree-stability-with-upgrades Hard
3661-maximum-walls-destroyed-by-robots Hard

Union-Find

Problem Name Difficulty
1559-detect-cycles-in-2d-grid Medium
1722-minimize-hamming-distance-after-swap-operations Medium
2573-find-the-string-with-lcp Hard
3600-maximize-spanning-tree-stability-with-upgrades Hard

Graph Theory

Problem Name Difficulty
3600-maximize-spanning-tree-stability-with-upgrades Hard

Minimum Spanning Tree

Problem Name Difficulty
3600-maximize-spanning-tree-stability-with-upgrades Hard

Math

Problem Name Difficulty
0048-rotate-image Medium
0396-rotate-function Medium
0788-rotated-digits Medium
1622-fancy-sequence Hard
1878-get-biggest-three-rhombus-sums-in-a-grid Medium
2946-matrix-similarity-after-cyclic-shifts Easy
3296-minimum-number-of-seconds-to-make-mountain-height-zero Medium
3464-maximize-the-distance-between-points-on-a-square Hard
3629-minimum-jumps-to-reach-end-via-prime-teleportation Medium
3761-minimum-absolute-distance-between-mirror-pairs Medium
3783-mirror-distance-of-an-integer Easy

Heap (Priority Queue)

Problem Name Difficulty
1878-get-biggest-three-rhombus-sums-in-a-grid Medium
3296-minimum-number-of-seconds-to-make-mountain-height-zero Medium

Design

Problem Name Difficulty
1622-fancy-sequence Hard
2069-walking-robot-simulation-ii Medium

Segment Tree

Problem Name Difficulty
1622-fancy-sequence Hard

Sorting

Problem Name Difficulty
1727-largest-submatrix-with-rearrangements Medium
1878-get-biggest-three-rhombus-sums-in-a-grid Medium
2463-minimum-total-distance-traveled Hard
2751-robot-collisions Hard
2840-check-if-strings-can-be-made-equal-with-operations-ii Medium
3464-maximize-the-distance-between-points-on-a-square Hard
3567-minimum-absolute-difference-in-sliding-submatrix Medium
3661-maximum-walls-destroyed-by-robots Hard

Two Pointers

Problem Name Difficulty
0061-rotate-list Medium
1855-maximum-distance-between-a-pair-of-values Medium
1861-rotating-the-box Medium
3643-flip-square-submatrix-vertically Easy

Enumeration

Problem Name Difficulty
3546-equal-sum-grid-partition-i Medium
3548-equal-sum-grid-partition-ii Hard

String Matching

Problem Name Difficulty
0796-rotate-string Easy
3474-lexicographically-smallest-generated-string Hard

Stack

Problem Name Difficulty
2751-robot-collisions Hard

Divide and Conquer

Problem Name Difficulty
3653-xor-after-range-multiplication-queries-i Medium
3655-xor-after-range-multiplication-queries-ii Hard

Depth-First Search

Problem Name Difficulty
1559-detect-cycles-in-2d-grid Medium
1722-minimize-hamming-distance-after-swap-operations Medium

Trie

Problem Name Difficulty
2452-words-within-two-edits-of-dictionary Medium

Counting

Problem Name Difficulty
2833-furthest-point-from-origin Easy

Geometry

Problem Name Difficulty
3464-maximize-the-distance-between-points-on-a-square Hard

Breadth-First Search

Problem Name Difficulty
1559-detect-cycles-in-2d-grid Medium
3629-minimum-jumps-to-reach-end-via-prime-teleportation Medium

Linked List

Problem Name Difficulty
0061-rotate-list Medium

Number Theory

Problem Name Difficulty
3629-minimum-jumps-to-reach-end-via-prime-teleportation Medium

About

Collection of LeetCode questions to ace the coding interview! - Created using [LeetHub](https://github.com/QasimWani/LeetHub)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors