Awesome Open Source
Awesome Open Source


GitHub last commit GitHub repo size in bytes Contributors Forks Stargazers Issues MIT License LinkedIn leetcode badge leetcode badge Travis Travis

This repo contains around 700 (600 Leetcode.com and 100 Algoexpert.io) problems in total, with solutions using Swift and Python

This repo contains my solutions to algorithmic problems in leetcode.com and algoexpert.io written in Swift and Python. Here is my leetcode profile And my Algoexpert.io certificate of completion

Show your support by giving it a STAR

AboutTopicsTipsLeetCode.comAlgoExpert.ioReferences



About

I have solved quite a number of problems from several topics. See the below table for further details.

Topics

  • Binary Search
  • Binary Search Tree
  • Binary Tree(Segment Tree)
  • N-aray Tree(Trie, Binary Indexed Tree)
  • Graph(Dijkstra, Union Find, Kruskal, Prim's, Minimum Spanning Tree, Topological Ordering...etc)
  • Stack
  • Queue
  • Array
  • Sorting
  • Hash Table
  • Heap
  • Linked list
  • Bit Operation
  • Dynamic programming
  • Backtracking(Permutations & Combinations & Subsets...etc)
  • Math
  • and more...

Questions from

My other related repos

My leetcode account

Tips

  • Check this Golden post first.
  • Whenever you solve a new question with some new techniques/algorithms, try to solve atleast 2 similar problem in a row. This way, your understanding to the new techniques/algorithms will be better.
  • Solve all leetcode cards
  • ...


LeetCode

leetcode badge

1. Arrays , HashMap, Set

Leetcode problems with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 1. Two Sum Python, Swift --- --- ✅ 📌 ⭐ 😭 🧐 😎
02 485. Max Consecutive Ones Swift
03 476. Number Complement Swift
04 461. Hamming Distance Swift
05 9. Palindrome Number Python
06 88. Merge Sorted Array Python
07 811. Subdomain Visit Count Python
08 771. Jewels and Stones Python
09 414. Third Maximum Number Python
10 259. 3Sum Smaller Python
11 16. 3Sum Closest Python
12 15. 3Sum Python
13 118. Pascal's Triangle Python
14 119. Pascal's Triangle II Python
15 238. Product of Array Except Self Python, Swift
16 724. Find Pivot Index Python
17 747. Largest Number At Least Twice of Others Python
18 581. Shortest Unsorted Continuous Subarray Python
19 904. Fruit Into Baskets Python Article, Video 1, Video 2 Medium Sliding Window, Two Pointer
20 56. Merge Intervals Python Article, Swift
21 334. Increasing Triplet Subsequence Python --- Medium ---
22 792. Number of Matching Subsequences Python Official Medium Very tricky. Check again
23 912. Sort an Array (Merge Sort) Python --- Medium ---
24 1118. Number of Days in a Month Python --- Easy ---
25 349. Intersection of Two Arrays Python Art 1, Art 2 Easy Very tricky and versatile
26 350. Intersection of Two Arrays II Python , , Easy Very tricky and versatile
27 303. Range Sum Query - Immutable Python Vid 1 Easy ---
28 560. Subarray Sum Equals K Python, Swift Art 1, Art 2, Art 3, Art 4, Art 5, Art 6 Medium Very tricky and persuasive with Sliding Window but it's not. This is a classic running sum problem
29 325. Maximum Size Subarray Sum Equals k Python Art 1 Medium Very tricky and persuasive with Sliding Window but it's not. This is a classic running sum problem
30 1074. Number of Submatrices That Sum to Target Python Art 1, Art 2, Art 3, Art 4 Extremely Hard Very tricky and hard, check again. Also DP
31 167. Two Sum II - Input array is sorted Python --- Easy Two pointer basics
32 1099. Two Sum Less Than K Python --- Easy Two pointer basics
33 26. Remove Duplicates from Sorted Array Python --- Easy Two pointer basics
34 977. Squares of a Sorted Array Python --- Easy Two pointer basics
35 713. Subarray Product Less Than K Python --- Medium Two pointer ad Sliding Window
36 75. Sort Colors Python Vid 1 Medium Two pointer
37 18. 4Sum Python --- Medium Two pointer
38 11. Container With Most Water Python --- Medium Two pointer
39 202. Happy Number Python Art 1 Easy Fast pointer Slow pointer
40 457. Circular Array Loop Python --- Medium Fast pointer Slow pointer. Check again
41 448. Find All Numbers Disappeared in an Array Python --- Easy Cyclic Sort
42 287. Find the Duplicate Number Python --- Medium Cyclic Sort. TODO: Check all other approaches
43 442. Find All Duplicates in an Array Python --- Medium Cyclic Sort TODO: Check all other approaches
44 41. First Missing Positive Python --- Hard Cyclic Sort, Very important
45 939. Minimum Area Rectangle Python Art 1 Medium Hash and Set, Very important
46 359. Logger Rate Limiter Python --- Easy Hash and Set, Very important
47 48. Rotate Image Python Must, Vid 1 Medium Very important
48 362. Design Hit Counter Python, Swift --- Medium ---
49 289. Game of Life Python, Swift --- Medium ---
50 54. Spiral Matrix Python, Swift Official, Algoexpert.io Medium ---
51 380. Insert Delete GetRandom O(1) Python, Swift Official Medium ---
52 835. Image Overlap Python, Swift Art 1, Art 2 Medium ---
53 1051. Height Checker Python, Swift --- Easy
55 683. K Empty Slots Python, Swift Art 1, Art 2, Art 3 Hard TODO: Check monotonic queue approach. Solved it with sliding widow
56 849. Maximize Distance to Closest Person Python, Swift Art 1 Easy Not so easy and intuitive. Can be solve is a variety of way. I have used Binary search(A bit over engineered solution). Can be simplifies
57 283. Move Zeroes Python, Swift --- Easy Not so easy and intuitive. Uses fast and slow pointer
58 163. Missing Ranges Python, Swift --- Medium Man, it's a very trick problem
59 1089. Duplicate Zeros Python, Swift Art 1 Easy Not so easy and intuitive. Check again
60 941. Valid Mountain Array Python, Swift Easy
61 731. My Calendar II Python, Swift Medium Merge interval
62 59. Spiral Matrix II Python, Swift Medium loved it
63 525. Contiguous Array Python, Swift Art 1 Medium loved it. Check again
64 379. Design Phone Directory Python, Swift Medium
65 280. Wiggle Sort Python, Swift Medium
66 246. Strobogrammatic Number Python, Swift Easy
67 845. Longest Mountain in Array Python, Swift Medium
68 66. Plus One Python, Swift Easy
69 957. Prison Cells After N Days Python, Swift Art 1, Art 2, Art 3, Art 4, Art 5 Medium
70 1232. Check If It Is a Straight Line Python, Swift Easy
71 348. Design Tic-Tac-Toe Python, Swift Vid 1, Art 1 Medium A fucking tricky question
72 1152. Analyze User Website Visit Pattern Python, Swift Art 1, Art 2, Art 3, Art 4 Medium A fucking unclear question and problem. I Fucking disliked it.
73 953. Verifying an Alien Dictionary Python, Swift Easy(REALLY!!!) Don't be fooled by the difficulty label
74 463. Island Perimeter Python, Swift Easy It's very deceiving, to think it as a grapy ad DFS problem, but it's not. Think simply
75 166. Fraction to Recurring Decimal Python, Swift Art 1 Medium Hate this problem. Why do companies ask this shit!!!
75 311. Sparse Matrix Multiplication Python, Swift Art 1, Art 2, Art 3, Art 4 Medium Very tricky
76 896. Monotonic Array Python, Swift --- Eassy
77 670. Maximum Swap Python, Swift Art 1 Medium
78 825. Friends Of Appropriate Ages Python, Swift Art 1 Medium Think differently from a different angle. Loved this problem
79 189. Rotate Array Python, Swift --- Easy Getting to inplace (O(n) time and O(1) space) solution is tricky.
80 1004. Max Consecutive Ones III Python, Swift --- Medium Solution is tricky.
81 498. Diagonal Traverse Python, Swift --- Medium ---
82 766. Toeplitz Matrix Python, Swift --- Easy ---
83 1031. Maximum Sum of Two Non-Overlapping Subarrays Python, Swift --- Medium PrefixSum
84 1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit Python, Swift (Art 1)[https://tinyurl.com/y69hjhjp], (Art 2)[https://tinyurl.com/y3h2fj2m] Medium Sliding window
85 1428. Leftmost Column with at Least a One Python, Swift --- Medium Binary Search
86 914. X of a Kind in a Deck of Cards Python, Swift --- Easy (Not So)
87 1275. Find Winner on a Tic Tac Toe Game Python, Swift Art 1 Easy (Not So)
88 532. K-diff Pairs in an Array Python, Swift Art 1 Medium
89 128. Longest Consecutive Sequence Python, Swift Art 1 Hard
90 1423. Maximum Points You Can Obtain from Cards Python, Swift Art 1, Art 2 Medium Very important. Learned new ways of sliding window
91 900. RLE Iterator Python, Swift --- Medium -

2. String

Leetcode problems with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 3. Longest Substring Without Repeating Characters
02 412. Fizz Buzz Swift
03 937. Reorder Log Files Python
03 929. Unique Email Addresses Python
04 7. Reverse Integer Python
05 13. Roman to Integer Python
06 125. Valid Palindrome Python, Swift
07 161. One Edit Distance Python
08 1119. Remove Vowels from a String Python
09 344. Reverse String Python
10 482. License Key Formatting Python
11 3. Longest Substring Without Repeating Characters Python Vid 1, Vid 2 Medium 📌 Sliding window, Two pointer
12 340. Longest Substring with At Most K Distinct Characters Python, Swift Vid 1, Art 1, Art 2 Hard 📌 Sliding window, Two pointer
13 159. Longest Substring with At Most Two Distinct Characters Python Vid 1 Hard 📌 Sliding window, Two pointer
14 424. Longest Repeating Character Replacement Python Vid 1, Vid 2, Art 1, Art 2, Art 3, Art 4 Medium 📌 Sliding window, Very important
15 76. Minimum Window Substring Python Vid 1, Vid 2, Vid 3 Hard 📌 Sliding window, Very important
16 727. Minimum Window Subsequence Python Vid 1, Art 1, Art 2 Hard 📌 Sliding window and DP, check the DP approach
17 438. Find All Anagrams in a String Python, Swift Must, Art 1 Medium 📌 Sliding window
18 567. Permutation in String Python Must Medium 📌 Sliding window
19 844. Backspace String Compare Python --- Easy 📌 Two Pointer
20 809. Expressive Words Python Art 1 Medium 📌 Logic ad analytical prolem
21 271. Encode and Decode Strings Python Art 1 Medium 📌 TODO: Check the second approach. Very Important
22 299. Bulls and Cows Python --- Easy ---
23 833. Find And Replace in String Python Art 1 Medium ---
24 49. Group Anagrams Python Art 1, Algoexpert.io Medium ---
25 551. Student Attendance Record I Python Easy ---
26 242. Valid Anagram Python, Swift Easy ---
27 1358. Number of Substrings Containing All Three Characters Python, Swift Art 1 Medium Sliding Window
28 459. Repeated Substring Pattern Python, Swift Art 1 Easy I fucking love this problem
29 681. Next Closest Time Python, Swift Art 1 Medium I feel stupid after trying my first solution
30 925. Long Pressed Name Python, Swift --- Easy
31 949. Largest Time for Given Digits Python, Swift --- Easy Not so easy
32 788. Rotated Digits Python, Swift --- Easy ---
33 388. Longest Absolute File Path Python, Swift --- Medium ---
34 616. Add Bold Tag in String Python, Swift --- Medium Merge intervals(hidden)
35 678. Valid Parenthesis String Python, Swift Art 1, Art 2, Art 3, Art 4 Medium Super tricky. Much check again
36 273. Integer to English Words Python, Swift Hard MUST check again
37 763. Partition Labels Python, Swift Medium
38 819. Most Common Word Python, Swift Art 1 Easy
39 350. Intersection of Two Arrays II Python, Swift --- Easy Check the follow-ups
40 249. Group Shifted Strings Python, Swift Art 1 Medium Tricky one
41 158. Read N Characters Given Read4 II - Call multiple times Python, Swift Art 1 Hard Good one
42 415. Add Strings Python, Swift Art 1 Easy ---
43 65. Valid Number Python, Swift Art 1 HARD A fucking difficult but important problem. Chack DFA approach
44 791. Custom Sort String Python, Swift --- Medium Loved this problem
45 157. Read N Characters Given Read4 Python, Swift --- Easy (Not So!) Loved this problem
46 722. Remove Comments Python, Swift Art 1 Medium
47 443. String Compression Python, Swift Art 1 Medium

3. Linked List

Leetcode problems with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 2. Add Two Numbers Python, Swift --- Medium Fundamental
02 707. Design Linked List Python
03 21. Merge Two Sorted Lists Python Algoexpert.io, Vid 1 Easy Fundamental and very very important
04 234. Palindrome Linked List Python --- Easy Fast pointer Slow pointer
05 24. Swap Nodes in Pairs Python
06 141. Linked List Cycle Python --- Easy Fast pointer Slow pointer
07 142. Linked List Cycle II Python Art 1, Art 2, AlgoExpert.io Medium Fast pointer Slow pointer
08 876. Middle of the Linked List Python --- Easy Fast pointer Slow pointer
09 143. Reorder List Python --- Medium Fast pointer Slow pointer
10 19. Remove Nth Node From End of List Python --- Medium Fast pointer Slow pointer
11 817. Linked List Components Python Art 1 Medium Uses set/dictionary
12 206. Reverse Linked List Python Vid 1, Vid 2 Easy Fundamental
13 92. Reverse Linked List II Python educative.io, Art 2 Medium Fundamental and very important
14 25. Reverse Nodes in k-Group Python educative.io, Art 1, Art 2 Hard Fundamental. TODO: Check again
15 24. Swap Nodes in Pairs Python educative.io Medium Fundamental
16 61. Rotate List Python educative.io Medium Fundamental
17 328. Odd Even Linked List Python Art 1 Medium Fundamental
18 148. Sort List Python Vid 1, Vid 2, Vid 3, Art 1 Medium Fundamental
19 23. Merge k Sorted Lists Python educative.io, Art 1 Hard Very important. TODO: Check heap approach
20 160. Intersection of Two Linked Lists Python Art 1, Art 2 Easy ---
21 138. Copy List with Random Pointer Python Vid 1, Art 1 Medium TODO: Check again. Very important. Learned a lot of things
22 430. Flatten a Multilevel Doubly Linked List Python backtobackswe.com, Vid 1, Art 1 Medium TODO: Check again. Very important. Learned a lot of things
23 146. LRU Cache Python Vid 1, backtobackswe.com, algoexpert.io Hard TODO: Check again. Very important. Learned a lot of things
24 460. LFU Cache Python Vid 1, backtobackswe.com, algoexpert.io Hard TODO: Check again. Very important. Learned a lot of things
25 460. LFU Cache Python Art 1 Easy
26 708. Insert into a Sorted Circular Linked List Python, Swift Art 1 Medium
27 203. Remove Linked List Elements Python, Swift --- Easy
28 432. All O`one Data Structure Python, Swift Art 1 Hard Super hard and super important
29 426. Convert Binary Search Tree to Sorted Doubly Linked List Python, Swift Art 1 Medium Super important
30 1265. Print Immutable Linked List in Reverse Python, Swift Art 1 Medium Really?? Are we supposed to solve a puzzle in an interview?

4. Stack, Queue

Leetcode problems with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 20. Valid Parentheses Python
02 155. Min Stack Python
03 84. Largest Rectangle in Histogram Python Video 01, Video 02, Article 01, Article 02 Hard 📌 Need to revise
04 394. Decode String Python --- Medium 📌 Classic stack problem
05 239. Sliding Window Maximum Python Video 1, Official, Art 1, Art 2, Art 3, Art 4 Hard 📌 Can be solved using Heap, Deque and DP
06 739. Daily Temperatures Python Video 1, Video 2, Art 1 Medium 📌 TODO: Check again. A tricky one
07 150. Evaluate Reverse Polish Notation Python, Swift Vid 1 Medium ---
08 341. Flatten Nested List Iterator Python, Swift Vid 1, Art 1, Art 2, Art 3, Art 4, Art 5 Medium TODO: Check again. Very Important. Learned new things
09 173. Binary Search Tree Iterator Python, Swift, Swift Vid 1, Art 1 Medium TODO: Check again. Very Important. Learned new things
10 284. Peeking Iterator Python, Swift Art 1 Medium ---
11 281. Zigzag Iterator Python, Swift Art 1 Medium ---
12 946. Validate Stack Sequences Python, Swift Art 1, Art 2 Medium ---
13 862. Shortest Subarray with Sum at Least K Python, Swift Art 1, Art 2, Art 3, Art 4 Hard Learned Monotonic Queue. Very interesting problem
14 346. Moving Average from Data Stream Python, Swift Easy
15 71. Simplify Path Python, Swift Medium
16 1249. Minimum Remove to Make Valid Parentheses Python, Swift Official Medium Must check
17 636. Exclusive Time of Functions Python, Swift Art 1 Medium Must check
18 921. Minimum Add to Make Parentheses Valid Python, Swift --- Medium ---
19 1209. Remove All Adjacent Duplicates in String II Python, Swift --- Medium ---
20 227. Basic Calculator II Python, Swift Art 1 Medium ---

5. Heaps

Leetcode problems with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 358. Rearrange String k Distance Apart Python Educative.io, Educative.io 2 Hard 📌 Similar to 621. Task Scheduler. Very Important. TODO: Check Heap approach
02 347. Top K Frequent Elements Python educative.io, Helper 1, Helper 2, heapq, Counter Medium ---
03 767. Reorganize String Python --- Medium Also check Greedy approach
04 621. Task Scheduler Python, Swift Ex 1, Ex 2, Vid 1, Vid 2, Vid 3, Vid 4 Medium 📌 Extremely tricky. Classic problem
05 295. Find Median from Data Stream Python algoexpert.io, educative.io, educative.io 2, codinginterviewclass.com, Official, FollowUp 1 Hard 📌 Very Tricky and important. TODO: Check again
06 480. Sliding Window Median Python educative.io, Vid 1 Hard 📌 Sliding window with 2 heap. very important
07 4. Median of Two Sorted Arrays Python Article 01, Art 2 Video 1 Hard 📌 Classic problem
08 215. Kth Largest Element in an Array Python Art 01, Algoexpert.io, educative.io Medium 📌 Also check Quickselect method.
09 373. Find K Pairs with Smallest Sums Python educative.io Hard 📌 TODO: Check again.
10 973. K Closest Points to Origin Python Algoexpert.io, educative.io, Vid 1 Medium 📌 Also check Quickselect and heap method
11 451. Sort Characters By Frequency Python Algoexpert.io, educative.io Medium 📌 Also check Quickselect and heap method
12 692. Top K Frequent Words Python Algoexpert.io, educative.io Medium 📌 Also check Quickselect and heap method
13 703. Kth Largest Element in a Stream Python educative.io Medium 📌 ---
14 895. Maximum Frequency Stack Python educative.io, Art 1 Hard 📌 TODO: Check again
15 378. Kth Smallest Element in a Sorted Matrix Python educative.io Hard 📌 TODO: Check again the Binary Search approach. Very important
16 632. Smallest Range Covering Elements from K Lists Python educative.io Hard 📌 TODO: Check again. Very important
17 846. Hand of Straights Python Art 1 Medium 📌 TODO: Check again. Very important
18 1167. Minimum Cost to Connect Sticks Python Art 1 Medium
19 1102. Path With Maximum Minimum Value Python Art 1, Art 2, Art 3 Medium Dijekstra

6. Binary Search

Leetcode problems with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 704. Binary Search Python --- Easy Basics
03 240. Search a 2D Matrix II Python Video 01, Video 02
04 74. Search a 2D Matrix Python Video 01, Video 02
05 1011. Capacity To Ship Packages Within D Days Python Discussion 1, Discussion 2, Discussion 3 Medium Difficult to spot the pattern, revise again
06 410. Split Array Largest Sum Python Vid 1, Art 1, Art 2 Hard 📌 TODO: Check again. It's a fucking difficult and interesting and important
07 4. Median of Two Sorted Arrays Python Article 01, Art 2 Video 1 Hard 📌 Classic problem
08 981. Time Based Key-Value Store Python Article 01 Medium 📌
09 **222. Count Complete Tree Nodes** Python, Swift Theory, Official Solution, Fantastic idea! Medium 📌 BS within BS
10 1231. Divide Chocolate Python Art 1, Art 2, Art 3, Vid 1 Hard 📌 Not done. Check again. Solve all similar question
11 69. Sqrt(x) Python --- Easy 📌 Binary Search Template I
12 374. Guess Number Higher or Lower Python --- Easy 📌 Binary Search Template I
13 33. Search in Rotated Sorted Array Python, Swift Educative.io Medium 📌 Binary Search Template I, Very important
14 81. Search in Rotated Sorted Array II Python --- Medium 📌 Binary Search Template I, very important
15 278. First Bad Version Python --- Easy 📌 Binary Search Template II
16 162. Find Peak Element Python --- Medium 📌 Binary Search Template II
17 153. Find Minimum in Rotated Sorted Array Python, Swift --- Medium 📌 Binary Search Template II
18 154. Find Minimum in Rotated Sorted Array II Python --- Hard 📌 Binary Search Template II, not done
19 34. Find First and Last Position of Element in Sorted Array Python, Swift Vid 1, Educative.io Medium 📌 Binary Search Template III
20 658. Find K Closest Elements Python Vid 1, educative.io Medium 📌 Binary Search Template III. TODO: Check Heap approach which is not done
21 702. Search in a Sorted Array of Unknown Size Python Educative.io Medium 📌 Binary Search Template I
22 378. Kth Smallest Element in a Sorted Matrix Python educative.io Hard 📌 TODO: Check again the Binary Search approach. Very important
23 1146. Snapshot Array Python Art 1 Medium Tricky use of binary search
24 1170. Compare Strings by Frequency of the Smallest Character Python --- Easy Binary Search, Very important
25 852. Peak Index in a Mountain Array Python, Swift --- Easy ---
25 209. Minimum Size Subarray Sum Python, Swift --- Medium Sliding window and Binary Search
26 363. Max Sum of Rectangle No Larger Than K Python, Swift Vid 1, Vid 2, Art 1, Art 2, Art 3 Hard DP and BS. Disn't understand S part. TODO: Check again
27 875. Koko Eating Bananas Python, Swift --- Medium I loved this problem
28 1060. Missing Element in Sorted Array Python, Swift --- Medium I loved this problem
29 1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold Python, Swift Art 1 Medium I loved this problem. Sliding window and Binary Search
30 774. Minimize Max Distance to Gas Station Python, Swift Vid 1, Art 1, Art 2, Art 1 Hard I loved this problem. Very important
31 1231. Divide Chocolate Python, Swift Art 1, Art 2, Art 3 Hard I loved this problem. Very important
32 1268. Search Suggestions System Python, Swift Art 1, Art 2, Art 3 Medium I loved this problem. Very versatile, ca be solved in a lot of different ways
33 540. Single Element in a Sorted Array Python, Swift Medium ---
34 441. Arranging Coins Python, Swift Easy ---
35 154. Find Minimum in Rotated Sorted Array II Python, Swift Art 1 Medium VERY IMPORTANT

7. Binary Tree

Binary Tree Bootcamp

Leetcode problems with solutions and tutorials/videos

Check this [golden](https://tinyurl.com/ujopecz) post.

# Title Solution Tutorial Level Remarks
01 226. Invert Binary Tree Python
02 101. Symmetric Tree Python
03 102. Binary Tree Level Order Traversal Python
04 107. Binary Tree Level Order Traversal II Python
05 103. Binary Tree Zigzag Level Order Traversal Python
06 104. Maximum Depth of Binary Tree Python Explanation
07 100. Same Tree Python
08 111. Minimum Depth of Binary Tree Python Easy ---
09 110. Balanced Binary Tree Python Video 1, Article 1, Article 2 Easy ---
10 105. Construct Binary Tree from Preorder and Inorder Traversal Python Art 1, Art 2, Vid 1 Medium DFS, Very Important
11 106. Construct Binary Tree from Inorder and Postorder Traversal Python, Swift Art 1 Medium DFS, Very Important
12 889. Construct Binary Tree from Preorder and Postorder Traversal Python Vid 1, Art 1, Art 2 Medium 📌 TODO: Check again. Important
13 124. Binary Tree Maximum Path Sum Python, Swift Art 1, Art 2, Vid 1, AlgoExpert Very Hard Very important and tricky
14 979. Distribute Coins in Binary Tree Python Art 1, Art 2, Art 3 Medium Very important. Postorder DFS
15 116. Populating Next Right Pointers in Each Node Python Art 1, Art 2, Art 3 Medium BFS/DFS, Level order traversal
16 117. Populating Next Right Pointers in Each Node II Python Vid 1, Vid 2 Medium Very tricky, check again
17 199. Binary Tree Right Side View Python, Swift --- Medium ---
18 863. All Nodes Distance K in Binary Tree Python Vid 1, Art 1, Art 2 Medium A combination of graph and tree. TODO: Check again. Very important
19 301. Remove Invalid Parentheses Python Vid 1, Vid 2, Art 1 Hard TODO: Not done, Check again. Very important. BFS and DFS
20 112. Path Sum Python Art 1 Easy ---
21 113. Path Sum II Python Art 1, Art 2 Medium ---
22 437. Path Sum III Python Educative.io, Art 1, Art 2 Medium 📌 A good example of Prefix Sum and DFS. Very Important
23 543. Diameter of Binary Tree Python, Swift Educative.io, Art 1 Medium 📌 Important
24 1110. Delete Nodes And Return Forest Python Vid 1, Vid 2, Art 1, Art 2 Medium 📌 **TODO: Check again. Important
25 257. Binary Tree Paths Python --- Easy DFS
26 1145. Binary Tree Coloring Game Python Art 1, Art 2 Medium DFS
27 298. Binary Tree Longest Consecutive Sequence Python Art 1 Medium DFS
28 951. Flip Equivalent Binary Trees Python Vid 1, Art 1 Medium DFS
29 528. Random Pick with Weight Python Vid 1, Art 1 Medium Very tricky
30 236. Lowest Common Ancestor of a Binary Tree Python, Swift Vid 1, Vid 2, Algoexpert.io, Official, Art 1, Art 2, Art 3 Medium TODO: Check Again. Very Important
31 114. Flatten Binary Tree to Linked List Python Art 1 Medium Classic Prolem
32 297. Serialize and Deserialize Binary Tree Python, Swift Vid 1 Hard Classic Prolem
33 993. Cousins in Binary Tree Python, Swift Easy(Not so)
34 572. Subtree of Another Tree Python, Swift Art 1 Easy(Not so)
35 314. Binary Tree Vertical Order Traversal Python, Swift Vid 1 Medium
36 987. Vertical Order Traversal of a Binary Tree Python, Swift Vid 1, Art 1, Art 2 Medium
37 958. Check Completeness of a Binary Tree Python, Swift Art 1 Medium
38 865. Smallest Subtree with all the Deepest Nodes Python, Swift Art 1, Art 2, Art 3, Art 4 Medium Vary ambigious question
39 1315. Sum of Nodes with Even-Valued Grandparent Python, Swift -- Medium --
40 129. Sum Root to Leaf Numbers Python, Swift -- Medium --
41 938. Range Sum of BST Python, Swift -- Medium --
42 1305. All Elements in Two Binary Search Trees Python, Swift -- Medium --
43 536. Construct Binary Tree from String Python, Swift -- Medium --
44 652. Find Duplicate Subtrees Python, Swift -- Medium --

8. Binary Search Tree

Leetcode problems with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 701. Insert into a Binary Search Tree Python --- Medium Fundamentals
02 700. Search in a Binary Search Tree Python --- Easy Fundamentals
03 270. Closest Binary Search Tree Value Python --- Easy Fundamentals
04 450. Delete Node in a BST Python --- Medium Fundamentals
05 98. Validate Binary Search Tree Python --- Medium Fundamentals
06 94. Binary Tree Inorder Traversal Python, Swift --- Medium Fundamentals
07 144. Binary Tree Preorder Traversal Python --- Medium Fundamentals
08 145. Binary Tree Postorder Traversal Python --- Hard Fundamentals
09 108. Convert Sorted Array to Binary Search Tree Python --- Easy Fundamentals
10 109. Convert Sorted List to Binary Search Tree Python --- Medium Classic problem. Very important
11 729. My Calendar I Python, Swift Art 1, Art 2 Medium Use self balancing BST for O(nlogn) solution. Very important
12 449. Serialize and Deserialize BST Python, Swift Art 1 Medium ---
13 1008. Construct Binary Search Tree from Preorder Traversal Python, Swift Art 1, Art 2, Art 3, Art 4 Medium ---
14 653. Two Sum IV - Input is a BST Python, Swift - Easy ---
15 99. Recover Binary Search Tree Python, Swift - Hard Very important, check again
16 230. Kth Smallest Element in a BST Python, Swift - Medium Easy peasy

9. N-Ary Tree

Leetcode problems with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 589. N-ary Tree Preorder Traversal Python
02 590. N-ary Tree Postorder Traversal Python
03 429. N-ary Tree Level Order Traversal Python
04 559. Maximum Depth of N-ary Tree Python
05 431. Encode N-ary Tree to Binary Tree Python Explanation
06 428. Serialize and Deserialize N-ary Tree Python Art 1, Official Hard Very important

10. Tree

Leetcode problems with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 315. Count of Smaller Numbers After Self Python Article 1, Article 2, Vid 1, Vid 2 Hard (Very) 📌 Very hard and important. First learn BIT, ST, AVL-Tree and Red-Black Tree then try again

11. Tries

Leetcode problems with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 208. Implement Trie (Prefix Tree) Python
02 211. Add and Search Word. Data structure design Python Video 01, Video 02
03 642. Design Search Autocomplete System Python Article 01, Video 01 Hard ---
04 472. Concatenated Words Python Art 01, Art 02 Hard Very important
05 588. Design In-Memory File System Python --- Hard ---
06 212. Word Search II Python, Swift Art 1 Hard ---
07 1233. Remove Sub-Folders from the Filesystem Python, Swift Art 1 Medium Didn't think of it as a trie. Good problem

12. Graphs

BFS, DFS, Dijkstra, Floyd–Warshall, Bellman-Ford, Kruskal, Prim's, Minimum Spanning Tree, Topological Ordering, Union Find.

Follow this golden rule to approach any graph problem.

Leetcode problems with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 207. Course Schedule Python educative.io Medium 📌 Very Important. Check again. BFS, Topological Sort
02 210. Course Schedule II Python educative.io Medium 📌 Very Important. Check again. BFS, Topological Sort
03 269. Alien Dictionary Python, Swift educative.io, Vid 1, Vid 2, Vid 3 Hard 📌 Very Important. Check again. BFS, Topological Sort
04 444. Sequence Reconstruction Python educative.io Medium/Hard 📌 Check again. BFS, Topological Sort
05 310. Minimum Height Trees Python educative.io Hard 📌 TODO: Check again, very hard, didn't get the intuition. BFS, Topological Sort
06 329. Longest Increasing Path in a Matrix Python Official, Art 1, Art 2 Hard ** 📌 TODO: Not Done, very hard and important. DP, Topological Sort **
07 1203. Sort Items by Groups Respecting Dependencies Python Hard 📌 TODO: Not Done, very hard, didn't get the intuition. BFS, Topological Sort
08 695. Max Area of Island Python --- Medium DFS
09 200. Number of Islands Python Algoexpert.io - DFS, Union Find, Art 1 Medium DFS + DFS, Union Find
10 305. Number of Islands II Python Union Find, Art 0, Art 1, Art 2, Art 3, Art 4, Art 5 Hard Union Find
11 399. Evaluate Division Python Art 0, Art 1, Art 2, Art 3, Art 4, Art 5 Medium TODO: Solve it using Union Find
12 841. Keys and Rooms Python codinginterviewclass.com, Art 1, Art 2 Medium BFS, DFS
13 490. The Maze Python codinginterviewclass.com, Vid 1, Art 1, Art 2, Art 3, Art 4, Art 5 Medium Modified BFS and DFS
14 130. Surrounded Regions Python codinginterviewclass.com, Art 1, Art 2 Medium TODO: Solve it using Union Find. Modified BFS and DFS
15 127. Word Ladder Python backtobackswe.com, Official, Art 1 Medium Very important and tricky. Modified BFS. Shortest Path finding
16 126. Word Ladder II Python backtobackswe.com, Official, Vid 1, Vid 2, Art 1 - Must Hard TODO: Not Done. Extremely tricky. Modified BFS. Learned Bidirectional Search
17 785. Is Graph Bipartite? Python, Swift backtobackswe.com, Official Medium Important, Learned new things. Undirected Graph
18 133. Clone Graph Python, Swift backtobackswe.com, Official Medium Important, Learned new things. Undirected Graph
19 332. Reconstruct Itinerary Python Vid 1, Vid 2, Art 1, Art 2, Art 3, Art 4 Medium Important, Learned new things. Directed Graph. Eulerian path and top Sort
20 1153. String Transforms Into Another String Python Vid 1, Vid 2, Art 1, Art 2, Art 3, Art 4, Art 5, Art 6 Extremely Hard TODO: Check again. Very Important and tricky, Learned new things. Digraph.
21 743. Network Delay Time Python Official, Dijkstra 1, Dijkstra 2, Vid 1, Art 1, Art 2, Art 3, Art 4 Medium TODO: Check again. Very Important. Learned (Dijkstra, Bellman, Floyed). Check references section
22 261. Graph Valid Tree Python Art 1, Art 2, Art 3, Art 4 Medium Important. BFS, DFS and Union Find
23 1168. Optimize Water Distribution in a Village Python Art 1, Art 2, Art 3, Art 4 Hard TODO: Check AGain. Prim's and Kruskal's algorithm. Important.
24 1197. Minimum Knight Moves Python Art 1 Medium TODO: Check AGain. Important.
25 1066. Campus Bikes II Python Vid 1, Art 1 Medium 📌 TODO: CHECK Dijkstra approach again. Backtracking solution is getting TLE. Solve it and implement it with DP also. Very important
26 752. Open the Lock Python Art 1, Art 2 Medium 📌 TODO: CHECK again. Very important and interesting problem. Loved it
27 489. Robot Room Cleaner Python, Swift Vid 1, Vid 2, Art 1 Hard 📌 TODO: CHECK again. Very important and interesting problem. I fucking loved it
28 1136. Parallel Courses Python, Swift --- Hard 📌 Topological sort.
29 947. Most Stones Removed with Same Row or Column Python, Swift Vid 1, Art 1, Vid 2, Art 2, Art 3 Medium 📌 DFS and Union FInd
30 1042. Flower Planting With No Adjacent Python, Swift --- Easy 📌 Could be done using DFS, BFS
31 994_Rotting_Oranges Python, Swift --- Medium 📌 BFS
32 909. Snakes and Ladders Python, Swift Art 1, Art 2, Art 3, Vid 1, Vid 2, Medium 📌 BFS. Check again
33 1192. Critical Connections in a Network Python, Swift Art 1, Art 2, Art 3, Art 4, Vid 1, Vid 2, Vid 3 Hard 📌 Important, Learned new things.Tarjans SCCs algorithm. Check again
34 694. Number of Distinct Islands Python, Swift Art 1, Art 2 Medium 📌
35 997. Find the Town Judge Python, Swift --- Easy 📌
36 733. Flood Fill Python, Swift --- Easy 📌
37 339. Nested List Weight Sum Python, Swift --- Easy 📌
38 1026. Maximum Difference Between Node and Ancestor Python, Swift --- Medium 📌
39 721. Accounts Merge Python, Swift --- Medium 📌 Loved it and hated it. Learned a lot. Very insightfull and tricky, deceiving problem. Be very carefull with your choice
40 1123. Lowest Common Ancestor of Deepest Leaves Python, Swift --- Medium 📌 Loved it and hated it.
41 419. Battleships in a Board Python, Swift --- Medium 📌 Union FInd and or DFS.
42 934. Shortest Bridge Python, Swift Art 1 Medium 📌 DFS and BFS
43 317. Shortest Distance from All Buildings Python, Swift Art 1 Hard 📌 BFS, a must do problem
44 93. Restore IP Addresses Python, Swift --- Medium 📌 A must do problem. Backtracking
45 1424. Diagonal Traverse II Python, Swift --- Medium 📌 Very interesting one.
46 364_Nested_List_Weight_Sum_II Python, Swift --- Medium 📌 Hidden DFS
47 1245. Tree Diameter Python, Swift Art 1 Medium 📌 Learned, 2 BFS. Important and interesting
48 1376. Time Needed to Inform All Employees Python, Swift Art 1 Medium 📌 BFS, DFS
49 286. Walls and Gates Python, Swift --- Medium 📌 BFS, DFS
50 1138. Alphabet Board Path Python, Swift --- Medium 📌 BFS
51 690. Employee Importance Python, Swift --- Easy 📌 BFS
52 **1631. Path With Minimum Effort ** Python, Swift --- Medium 📌 BFS, DFS, Binary search
53 **547. Friend Circles ** Python, Swift Art 1, Art 2 Medium 📌 BFS, DFS, Union Find

13. Recursion, Iteration

Leetcode problems with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 509. Fibonacci Number Python
02 50. Pow(x, n) Python
00 It's a general topics which has been covered on Backtracking and graph problems --- --- --- ---

14. Backtracking

Leetcode problems with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 211. Add and Search Word. Data structure design Python Video 01, Video 02
02 37. Sudoku Solver Python Video 01, Video 02
03 52. N-Queens II Python Video 01, Video 02
04 784. Letter Case Permutation Python --- Easy Backtracking Fundamentals
05 1219. Path with Maximum Gold Python --- Medium 📌 ---
06 79. Word Search Python Article 1 Medium Backtracking Fundamentals
07 679. 24 Game Python Art 1, Art 2, Art 3, Official Very Hard 📌 Very tricky and important. Revise again.
08 1066. Campus Bikes II Python Vid 1, Art 1 Medium 📌 TODO: CHECK Dijkstra approach again. Backtracking solution is getting TLE. Solve it and implement it with DP also. Very important
09 1087. Brace Expansion Python --- Medium 📌 ---
10 78. Subsets Python Video 1, Video 2, Video 3, Article 1, educative.io Medium 📌 TODO: check bit manipulation
11 90. Subsets II Python Video 1, Video 2, Video 3, Article 1, educative.io Medium 📌
12 46. Permutations Python codinginterviewclass.com, algoexpert.io, educative.io, Article 1, Article 2 Medium Backtracking Fundamentals
13 47. Permutations II Python codinginterviewclass.com, algoexpert.io, educative.io, Article 1 Medium Backtracking Fundamentals
14 31. Next Permutation Python, Swift backtobackswe.com, Vid 1, Art 1, Official Medium Backtracking
15 77. Combinations Python codinginterviewclass.com Medium Backtracking
16 39. Combination Sum Python Article 1, Article 2 Medium Backtracking Fundamentals
17 40. Combination Sum II Python --- Medium Backtracking Fundamentals
18 17. Letter Combinations of a Phone Number Python Video 1, Video 2 - paid course, Article 1 Medium Backtracking Fundamentals
19 22. Generate Parentheses Python, Swift educative.io, Video 1, Article 1 Medium Backtracking Fundamentals
20 1088. Confusing Number II Python, Swift Art 1, Ref 1 Hard Very interesting
21 465. Optimal Account Balancing Python, Swift Art 1 Hard Loved the question, awsome real life description
22 1079. Letter Tile Possibilities Python, Swift --- Medium 📌 Could be done using DFS, backtracking
23 60. Permutation Sequence Python, Swift Art 1 Medium 📌 What an awesome question and smart solution. loved it.

15. Greedy

Leetcode problems with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 1055. Shortest Way to Form String Python Art 1, Art 2, Art 3, Art 4, Art 5 Medium 📌 Very important and hard problem
02 1057. Campus Bikes Python Video 01, Article 01 Medium 📌 Solve 1066. Campus Bikes II using DP, DFS and Priority Queue
03 1007. Minimum Domino Rotations For Equal Row Python Vid 1, Vid 2,Art 1,Art 2,Art 3 Medium 📌 Hard to spot if it is a Greedy. Very Important
04 406. Queue Reconstruction by Height Python Article 1, Article 2 Medium 📌 Fundamentals
05 621. Task Scheduler Python Ex 1, Ex 2, Vid 1, Vid 2, Vid 3, Vid 4 Medium 📌 Extremely tricky. Classic problem
06 392. Is Subsequence Python Ex 1, Ex 3 Easy 📌
07 55. Jump Game Python Official , Art 1 Medium 📌 Must Check. Learned a lot
08 45. Jump Game II Python educative.io, Vid 1, Vid 2, Vid 3, Art 1 Hard 📌
09 767. Reorganize String Python --- Medium Also check Heap approach
10 435. Non-overlapping Intervals Python Vid 1, Art 1 Medium Classic problem
11 57. Insert Interval Python Must Hard Greedy and Merge interval
12 986. Interval List Intersections Python, Swift --- Medium Greedy and Two Pointer
13 252. Meeting Rooms Python Official Easy Greedy and uses heap
14 253. Meeting Rooms II Python, Swift Official Medium Greedy and uses heap
15 759. Employee Free Time Python Educative.io Hard Greedy and uses heap. Not done. Check again
16 659. Split Array into Consecutive Subsequences Python Art 0, Art 1, Art 2, Art 3, Vid 1, Art 4 Medium 📌 It's a fucking unclear problem. TODO: Not done. Check again later
17 68. Text Justification Python Vid 1, Vid 2, Vid 3, Art 0, Art 1 Hard TODO: Check again later. Very Important
18 134. Gas Station Python, Python, Swift Vid 1, Art 1 Medium TODO: Check again later. Very Important
19 1288. Remove Covered Intervals Python Art 1 Medium Line Swap with Greedy. A must read solution. A gold mie, learned a lot
20 1296. Divide Array in Sets of K Consecutive Numbers Python, Swift Art 1 Medium ---
21 984. String Without AAA or BBB Python, Swift Art 1 Medium ---

16. Dynamic Programming

Follow this golden rule to approach any DP problem.

Leetcode problems with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 53. Maximum Subarray Python Vid 1, Algoexpert.io Easy Kadane's Algorithm
02 518. Coin Change 2 Python educative.io, Vid 1, codinginterviewclass.com, Algoexpert.io Medium Unbounded Knapsack
03 322. Coin Change Python educative.io, Vid 1, Algoexpert.io Medium Unbounded Knapsack
04 72. Edit Distance Python educative.com, algoexpert.io, codinginterviewclass.com, Vid 1, Vid 2 Hard TODO: Check again. Very important and classic. Levenshtein Distance
05 70. Climbing Stairs Python educative.io Easy Fibonacci sequence pattern
06 96. Unique Binary Search Trees Python educative.io, Vid 1, Art 1, Vid 2, Vis 3 Medium 📌 Fundamentals
07 95. Unique Binary Search Trees II Python educative.io Medium ---
08 221. Maximal Square Python Video 01, Video 02
09 85. Maximal Rectangle Python Video 01
10 42. Trapping Rain Water Python Article 01 Hard 📌 Check stack and 2 pointers based solutions
11 300. Longest Increasing Subsequence Python educative.io, codinginterviewclass.com, algoexpert.io, Vid 01, Vid 2 Medium 📌 Need to check Binary Search approach, which is a lot harder
12 1143. Longest Common Subsequence Python educative.io, algoexpert.io Medium 📌 Classic DP
13 5. Longest Palindromic Substring Python educative.io, algoexpert.io, Vid 1 Medium 📌 Classic DP
14 1066. Campus Bikes II Python Medium 📌 TODO: Backtracking solution is getting TLE. Solve it and implement it with DP also
15 121. Best Time to Buy and Sell Stock Python Vid 1 Easy Fundamental
16 122. Best Time to Buy and Sell Stock II Python Video 01 Easy More like Greedy
17 123. Best Time to Buy and Sell Stock III Python Vid 1, Vid 2 Hard Fundamental
18 188. Best Time to Buy and Sell Stock IV Python Vid 1, Vid 2 Hard Getting "Memory Limit Exceeded"
19 309. Best Time to Buy and Sell Stock with Cooldown Python Must, Art0, Art1, Must 2 , Art 2, Art 3 Medium Very tricky, must check again. Couldn't solve
20 714. Best Time to Buy and Sell Stock with Transaction Fee Python Must Read , Art 2 Medium More like Greedy, but DP
21 198. House Robber Python Must, educative.io Easy A Gold Mine
22 213. House Robber II Python Art 1, Art 2 Medium ---
23 337. House Robber III Python Art 1 Medium Another gold mine, hidden greedy and DFS
24 416. Partition Equal Subset Sum Python educative.io, Art 1, Vid 1, Vid 2, Vid 3, Vid 4 Medium 0/1 Knapsack, Very important
25 494. Target Sum Python educative.io, MUST MUST READ Medium 0/1 Knapsack, Very important. TODO: Not DOne. Check again
26 343. Integer Break Python Art 1, Art 2 Medium Unbounded Knapsack. TODO: Not Done. Check again
27 516. Longest Palindromic Subsequence Python educative.io, Vid 1, Vid 2 Medium ---
28 647. Palindromic Substrings Python educative.io Medium ---
29 680. Valid Palindrome II Python educative.io, Art 1, Art 2 Medium ---
30 1312. Minimum Insertion Steps to Make a String Palindrome Python educative.io Hard ---
31 132. Palindrome Partitioning II Python educative.io, algoexpert.io, Vid 1, Vid 2 Hard TODO: Check again. Very difficult and important
32 718. Maximum Length of Repeated Subarray Python educative.io Medium Longest Common Substring variation
33 583. Delete Operation for Two Strings Python educative.io Medium ---
34 1092. Shortest Common Supersequence Python educative.io, Art 1 Hard TODO: Not Done
35 115. Distinct Subsequences Python educative.io Hard TODO: Check again
36 97. Interleaving String Python educative.io, Vid 1 Hard TODO: Check again. Very difficult and tricky to understand
37 1048. Longest String Chain Python Art 1 Medium Modified LIS
38 801. Minimum Swaps To Make Sequences Increasing Python Art 1, Art 2 Medium TODO: Check again. Very analytical and tricky to come up with
39 279. Perfect Squares Python Must, Vid 1, Vis 2 Medium TODO: Check again. Very Important. Very analytical and tricky to come up with
40 139. Word Break Python Must, Vid 1, Vis 2, Vid 3 Medium TODO: Check again. Very Important.
41 62. Unique Paths Python, Swift Vid 1, Art 1, Art 2 Medium TODO: Check again
42 152. Maximum Product Subarray Python, Swift Vid 1, Art 1 Medium Kadane's algorithm on multiplication
43 64. Minimum Path Sum Python, Swift --- Medium ---
44 91. Decode Ways Python, Swift Vid 1 Medium ---
45 975. Odd Even Jump Python, Swift Vid 1, Art 1 Hard DP using stack. Vary tricky and Interesting problem, loved it
46 562. Longest Line of Consecutive One in Matrix Python, Swift Art 1, Art 2 Medium
47 552. Student Attendance Record II Python, Swift Art 1, Art 2, Art 3 Hard This is a FUCKING difficult DP problem. Don't dare to solve it
48 1320. Minimum Distance to Type a Word Using Two Fingers Python, Swift Vid 1, Art 1, Art 2, Art 3, Art 4 Hard Important. TODO: Check again
49 688. Knight Probability in Chessboard Python, Swift Art 1, Art 2, Art 3 Medium(Really!) Important, and fucking difficult. TODO: Check again
50 140. Word Break II Python, Swift Art 1, Art 2 Hard OHH Boy, you must recheck this, Important. TODO: Check again. An unique combination of DP, DFS and Backtracking
51 1027. Longest Arithmetic Sequence Python, Swift Art 1, Art 2 Medium I didn't know that map can be used in 1d bottom-up dp. learned new things
52 304. Range Sum Query 2D - Immutable Python, Swift Art 1, Art 2 Medium very good question, classical
53 1477. Find Two Non-overlapping Sub-arrays Each With Target Sum Python, Swift Art 1, Art 2 Medium Very interesting and deceiving and tricky problem. An unique combination of sliding window and DP
54 368. Largest Divisible Subset Python, Swift Official Solution Medium Interesting problem.
55 523. Continuous Subarray Sum Python, Swift Art 1 Medium Tricky to see the DP
56 689. Maximum Sum of 3 Non-Overlapping Subarrays Python, Swift Art 1 Hard Mainly, tricly array index manipulation. TODO: need to solve it in DP and sliding window approach
57 338. Counting Bits Python, Swift Medium ---
58 1269. Number of Ways to Stay in the Same Place After Some Steps Python, Swift Art 1 Hard Loved the problem. Very versatile
59 1277. Count Square Submatrices with All Ones Python, Swift Must Medium ---

17. Bit Manipulation

Follow this golden rule to approach any DP problem.

Leetcode problems with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 78. Subsets Python Video 1, Video 2, Video 3 Medium 📌 TODO: code it in all 4 ways. First complete DFS, BFS, Bit Manipulation and some easy back tracking problem. ⭐ 😭 Didn't understand, check again
02 187. Repeated DNA Sequences Python Official Medium ⭐ 😭 Didn't understand, check again
03 461. Hamming Distance Python --- Easy 📌 The key here is to practice bit operation, i ignore any other attempts
04 371. Sum of Two Integers Python Video 1, Atricle 1 Easy 📌 The key here is to practice bit operation, i ignore any other attempts
05 169. Majority Element Python Atricle 1 Easy 📌 The key here is to practice bit operation, i ignore any other attempts
06 191. Number of 1 Bits Python Article 1 Easy 📌 The key here is to practice bit operation
07 268. Missing Number Python Educative.io, Official Easy 📌 Learned few very important binary logic properties. Also check cyclic sort technique
08 389. Find the Difference Python --- Easy 📌
09 231. Power of Two Python Official, Signed number representations Easy 📌 Learned few very important binary logic properties
10 136. Single Number Python Educative.io Easy 📌 The key here is to practice bit operation, i ignore any other attempts
11 137. Single Number II Python 1, 2, 3, Check discussion Medium ⭐ 😭 Didn't understand, check again
12 260. Single Number III Python Educative.io Medium ⭐ Check again, very important
13 476. Number Complement Python Educative.io Easy ⭐ Check again
14 832. Flipping an Image Python Educative.io Easy ⭐ Check again
15 67. Add Binary Python, Swift Official, Art 1, Art 2, Vid 1, Vid 2 Easy (FUCK NO) ⭐ Check again

18. Miscellaneous (Line Swap, Binary Indexed Tree, Segment Tree, Minimax, Math, AVL Tree, Red-Black Tree, Interval Tree etc)

Leetcode problems with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 218. The Skyline Problem Python, Swift Vid 1, Vid 2, Vid 3, Vid 4, Art 1 Hard TODO: Not Done. Very important.
02 375. Guess Number Higher or Lower II Python, Swift Art 0, Art 1, Art2 2, Art 3 Hard TODO: Not Done. Very important. Did't understand properly
03 843. Guess the Word Python Art 1 Hard Minimax. TODO: Check again. Very important and interesting
04 593. Valid Square Python Art 1, Art 2 Medium Math
05 1272. Remove Interval Python Art 1 Medium Line Swap
06 1288. Remove Covered Intervals Python Art 1 Medium Line Swap with Greedy. A must read solution. A gold mie, learned a lot
07 1229. Meeting Scheduler Python Art 1 Medium Line Swap, learned a lot
08 850. Rectangle Area II Python Art 1, Vid 1, Art 2 Hard Line Swap using heap and Segment Tree. TODO: Solve it using Segment Tree
09 307. Range Sum Query - Mutable Python Vid 1, Art 1, Art 2 Medium Segment Tree Basics. Very Important
10 327. Count of Range Sum Python Vid 1, Art 1, Art 2 Hard Segment Tree Basics. Very Important
11 239. Sliding Window Maximum Python Video 1, Official, Art 1, Art 2, Art 3, Art 4 Hard 📌 Here, I have specifically focused on solving it with AVL and Red-Black Tree. A "Queue" approach can be found o Queue section
12 398. Random Pick Index Python Video 1, Art 1, Art 2, Art 3, Art 4, Art 5 Medium (Really!!??) 📌 Reservoir sampling, What's the point of asking this into an interview!!??
13 319. Bulb Switcher Python Art 1, Art 2, Art 3 Medium (Really!!??) Are you fucking kidding me!! We are programmers, not math wizard.
14 1344. Angle Between Hands of a Clock Python, Swift --- Medium FB really likes to ask tricky question.
15 1276. Number of Burgers with No Waste of Ingredients Python, Swift Art 1, Art 2, Art 3 Medium Pure math
16 777. Swap Adjacent in LR String Python, Swift Art 1 Medium Brainteser


AlgoExpert

100 Problems

My certificate of completion

1. Arrays

Problem statement from AlgoExpert.io with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 Two_Number_Sum Swift, Python
02 Three_Number_Sum Python
03 Smallest_Difference Python
04 Four_Number_Sum Python
05 Subarray_Sort Python
06 Largest_Range Python
07 Min_Rewards Python
08 Zigzag_Traverse Python
08 Apartment_Hunting Python
09 Calendar_Matching Python
10 Spiral_Traverse Python
11 Monotonic_Array Python
12 Move_Element_To_End Python
13 Longest_Peak Python

2. Binary Search Tree

Problem sstatement from AlgoExpert.io with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 BST_Construction_Iterative Python
02 BST_Construction_Recursive Python
03 Validate_BST Python
04 Find_Closest_Value_in_BST Python
05 BST_Traversal Python
06 Same_BSTs Python

3. Binary Tree

Problem sstatement from AlgoExpert.io with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 Invert_Binary_Tree Python
02 Max_Path_Sum_In_Binary_Tree Python
03 Iterative_In-order_Traversal Python
04 Right_Sibling_Tree Python
05 Branch_Sums Python
06 Flatten_Binary_Tree Python

4. Dynamic Programming

Problem statement from AlgoExpert.io with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 Number_Of_Ways_To_Make_Changes Python
02 Minimum_Number_Of_Coins_For_Change Python
03 Levenshtein_Distance Python
04 Min_Number_Of_Jumps Python Video 1
05 Max_Sum_Increasing_Subsequence Python
06 Longest_Common_Subsequence Python Video 1
07 Water_Area Python
08 Knapsack_Problem Python
09 Disk_Stacking Python
10 Numbers_In_Pi Python
11 Maximum_Subset_Sum_With_No_Adjacent_Element Python
12 Max_Profit_With_K_Transactions Python
13 Palindrome_Partitioning_Min_Cuts Python
14 Longest_Increasing_Subsequence Python Video 1, Video 2, , Video 3
15 Longest_String_Chain Python ---

5. Famous Algorithm

Problem statement from AlgoExpert.io with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 Kadane's_Algorithm Python
02 Topological_Sort Python
03 KMP_Algorithm Python

6. Graphs

Problem sstatement from AlgoExpert.io with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 Youngest_Common_Ancestor Python
02 Single_Cycle_Check Python
03 River_Sizes Python
04 Depth_First_Search Python
05 Breadth_First_Search Python
06 Boggle_Board Python
07 Rectangle_Mania Python
07 Airport_Connections Python

7. Heaps

Problem sstatement from AlgoExpert.io with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 Min_Heap_Construction Python Video 1
02 Continuous_Median Python Video 1, Video 2

8. Linked List

Problem sstatement from AlgoExpert.io with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 Remove_Kth_Node_From_End Python
02 Linked_List_Construction Python
03 Find_Loop Python
04 Reverse_Linked_List Python
05 LRU_Cache Python
06 Merge_Linked_List Python

9. Recursion

Problem sstatement from AlgoExpert.io with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 Powerset Python
02 Permutations Python
03 Nth_Fibonacci Python
04 Product_Sum Python
05 Lowest_Common_Manager Python
06 Number_Of_Possible_Binary_Tree_Topologies Python
07 Interweaving_Strings Python
08 Number_Of_Binary_Tree_Topologies Python

10. Searching

Problem sstatement from AlgoExpert.io with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 Search_In_Sorted_Matrix Python
02 Find_Three_Largest_Number Python
03 Binary_Search Python
04 Shifted_Binary_Search Python
05 Search_For_Range Python
06 Quick_Select (Kth smallest/largest element) Python

11. Sorting

Problem sstatement from AlgoExpert.io with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 Selection_Sort Python
02 Insertion_Sort Python
03 Bubble_Sort Python
04 Quick_Sort Python Video 1
05 Heap_Sort Python
06 Merge_Sort Python

12. Stacks

Problem sstatement from AlgoExpert.io with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 Balanced Bracket Python
02 Min_Max_Stack_Construction Python

13. String

Problem statement from AlgoExpert.io with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 Palindrom_Check Python
02 Longest_Palindromic_Substring Python
03 Caesar_Cipher_Encryptor Python
04 Longest_Substring_Without_Duplication Python
05 Underscorify_Substring Python --- Hard TODO: Check again. Difficult to analyse the space ad time complexity
06 Pattern_Matcher Python
07 Smallest_Substring_Containing Python
08 Group_Anagrams Python

14. Tries

Problem sstatement from AlgoExpert.io with solutions and tutorials/videos

# Title Solution Tutorial Level Remarks
01 Suffix_Trie_Construction Python
02 Multi_String_Search Python


References

Some helpful links, channels, tutorials, blogs.

1. Strategies

Check this Golden posts first.

  1. How a Googler solves coding problems
  2. Nail Every Coding Interview by Becoming Asymmetrical
  3. How to get into FAANG
  4. Preparing for Programming interview with Python
  5. The 30-minute guide to rocking your next coding interview
  6. Google Interview Part-1 , Google Interview Part-2, Google Interview Part-3, Final Part
  7. Amazon ও Google এ চাকরির সুযোগ পাওয়ার প্রস্তুতি পর্ব
  8. How to use LeetCode effectively
  9. How to solve ANY interview question
  10. How To Ace The Google Coding Interview - Complete Guide
  11. Software Engineering Interviews: The Golden Path To Passing
  12. A MUST READ
  13. 10 Steps to Solving a Programming Problem
  14. Preparing to Apply or Interview at Google - Youtue playlist
  15. Amazon ও Google এ চাকরির সুযোগ পাওয়ার প্রস্তুতি পর্ব
  16. Coding Interviews
  17. Tech Interview Handbook
  18. Complete Introduction to the 30 Most Essential Data Structures & Algorithms
  19. How to Solve Any Code Challenge or Algorithm

2. Courses/Books

  1. Data Structures in Python: An Interview Refresher
  2. Grokking the Coding Interview: Patterns for Coding Questions
  3. Grokking Dynamic Programming Patterns for Coding Interviews
  4. Coding Interview Class
  5. Competitive Programmer’s Handbook

3. Swift

4. Python

Learn the following modules by heart. Just knowing all of the following items will made most of the problem one-liners.

  1. itertools - Functions creating iterators for efficient looping - They will help you, more often than you think
  2. collections - High-performance container datatypes - Believe me, this is pretty awesome
  3. heapq - Heap queue algorithm - Obviously, we don't have to hand-code heaps anymore
  4. bisect - Array bisection algorithm - Binary Search, simplified
  5. Set
  6. Dict - Now on, hash Tables are fun to work with
  7. Sorting - Don't participate in competitions without reading this completely.
  8. Start using lambda extensively
  9. functools
  10. Apart from these, all the builtin methods of default containers.
  11. Understanding slice notation - you will need/use it more than you can imagine
  12. Magic Methods

5. Channels

  1. Tushar Roy - Coding Made Simple
  2. Back To Back SWE
  3. William Fiset
  4. Irfan Baqui

6. Tree (Binary Tree, BST, AVL, Red-Black, B-Tree, B+ Tree, Segment Tree, Interval Tree, Range Tree, BIT, N-aray Tree, Trie etc)

Tree Basics (or not so basics)

  1. Binary Tree playlist - Tushar Roy - Coding Made Simple
  2. 8 Useful Tree Data Structures Worth Knowing
  3. Segment Tree Range Minimum Query
  4. Exploring Segment Trees
  5. AVL Tree - Insertion and Rotations
  6. B Trees and B+ Trees. How they are useful in Databases
  7. Red Black Tree Insertion --- NOTE: Partho, read this
  8. Fenwick Tree or Binary Indexed Tree
  9. Fenwick Tree ( Binary Index Tree ) --- NOTE: Partho, read this

Binary Indexed Tree Vs Fenwick Tree

  1. Fenwick Tree or Binary Indexed Tree - youtube
  2. Binary Indexed Tree or Fenwick Tree - geeksforgeeks
  3. Binary Indexed Tree or Fenwick Tree - topcoder
  4. Segment Tree Range Minimum Query - youtube
  5. Segment Tree | Set 1 (Sum of given range) - geeksforgeeks
  6. Practical Data Structures for Frontend Applications: When to use Segment Trees
  7. What is the difference between a binary indexed tree and a segment tree?
  8. How does one decide when to use a Segment Tree or Fenwick Tree?
  9. What are the differences between segment trees, interval trees, binary indexed trees and range trees?
  10. Height, Depth and Level of a Tree
  11. What is the difference between tree depth and height?

Self Balancing Binary Search Trees

  1. Self-balancing binary search tree
  2. Self-Balancing-Binary-Search-Trees (Comparisons)
  3. Self-Balancing Binary Search Trees 101
  4. 10.1 AVL Tree - Insertion and Rotations
  5. Red Black tree | Introduction to Red Black trees | Data structure
  6. Red Black Tree Insertion
  7. Title
  8. Title
  9. Title

Augmented Binary Search Trees(Interval BS Vs Segment Tree Vs Range Tree)

  1. Interval Search Trees - video
  2. Interval Tree
  3. What are the differences between segment trees, interval trees, binary indexed trees and range trees?
  4. Interval Trees: One step beyond BST
  5. Title
  6. Title

7. Graph(Dijkstra, Union Find, Kruskal, Prim's, Minimum Spanning Tree, Topological Ordering...etc)

  1. Graph Theory Playlist
  2. Graph Theory Playlist 2
  3. Union Find [Disjoint Set] Playlist
  4. Disjoint Sets Data Structure - Weighted Union and Collapsing Find
  5. Codinginterviewclass.com
  6. Single(Di-Bel)/All(Flo) Source Shortest Path Algorithms: Dijkstra (1, 2), Bellman-Ford(1, 2), Floyd–Warshall(1, 2)
  7. Dijkstra’s Algorithm Vs Bellman-Ford Algorithm Vs Floyd Warshall Algorithm ( 1, 2, 3 )
  8. Minimum Spanning Tree Algorithm: Prim's ( 1, 2, Kruskal's (1, 2 )
  9. Kruskal's algorithm Vs Prim's algorithm ( 1, 2, 3 )
  10. Tushar Roy - Coding Made Simple - Grapy Algorithm Playlist

8. Bit Manipulation

  1. Bit Manipulation - youtube
  2. Conversion of Binary, Octal and Hexadecimal Numbers
  3. Your guide to Bit Manipulation
  4. Python Bitwise Operators
  5. Add Two Numbers Without The "+" Sign (Bit Shifting Basics)
  6. Binary Arithmetic
  7. 1’s and 2’s complement of a Binary Number
  8. What is “2's Complement”?
  9. Bits manipulation (Important tactics)
  10. Bit Manipulation
  11. Python Bitwise Operators
  12. XOR - The magical bitwise operator
  13. A summary: how to use bit manipulation to solve problems easily and efficiently - leetcode
  14. Bit Manipulation 4% of LeetCode Problems
  15. Coding Interview University - Bitwise operations
  16. Mask (computing)
  17. What is Bit Masking?
  18. Understanding Bit masks
  19. Bitmasks: A very esoteric (and impractical) way of managing booleans
  20. Hacker’s Delight - BOOK
  21. Bitwise operators — Facts and Hacks
  22. Signed number representations
  23. Vid 1, Vid 2

9. Dynamic Programming

  1. The FAST method
  2. A good approach to attack DP
  3. Tabulation vs Memoization
  4. Memoization vs Tabulation
  5. 1D Subproblems vs. 2D Subproblems
  6. Memoization (1D, 2D and 3D)
  7. Introduction to Multi-dimensional Dynamic Programming
  8. Dynamic Programming Patterns - MUST READ
  9. My experience and notes for learning DP
  10. DP IS EASY! 5 Steps to Think Through DP Questions
  11. Dynamic Programming Patterns

10. Greedy

  1. Greedy Method - Introduction
  2. Introduction to Greedy Method
  3. Introduction to Greedy Algorithms | GeeksforGeeks
  4. Basics of Greedy Algorithms
  5. When to try greedy algorithms on problems?
  6. How to spot a “greedy” algorithm?

11. DP VS Greedy

  1. Greedy Algorithm and Dynamic Programming
  2. Greedy approach vs Dynamic programming
  3. What is the difference between dynamic programming and greedy approach?

12. Backtracking

  1. Backtracking - wiki
  2. Backtracking | Introduction
  3. Introduction to Backtracking - Brute Force Approach
  4. Branch and Bound Introduction
  5. The Backtracking Blueprint: The Legendary 3 Keys To Backtracking Algorithms
  6. Backtracking explained
  7. Foundation of algorithms - Chapter 5 (Backtracking) notes
  8. Backtracking Search Algorithms

13. Recursion

  1. Learning to think with recursion, part 1
  2. Learning to think with recursion, part 2
  3. What makes a data structure recursive?
  4. Binary Tree as a Recursive Data Structure
  5. Recursion Visualizer - use Viz Mode
  6. Thinking Recursively in Python
  7. Breaking out of a recursive function?
  8. Why does recursion return the first call in the stack and not the last?

14. Game Theory

  1. Intuition for Solving a MiniMax Problems
  2. Game theory — Minimax
  3. How to make your Tic Tac Toe game unbeatable by using the minimax algorithm

15. Few special DS

  1. Monotonic Queue Explained with LeetCode Problems

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
python (51,910
swift (7,620
python3 (1,570
algorithms (443
graph (391
leetcode (185
queue (172
stack (113
leetcode-solutions (65
tree-structure (41
dynamic-programming (40
trie (38
heap (34
swift-5 (19
binary-search-tree (16
binary-search (15

Find Open Source By Browsing 7,000 Topics Across 59 Categories