| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This repo contains my solutions to algorithmic problems in leetcode.com and algoexpert.io written in Swift and Python.
About • Topics • Tips • LeetCode.com • AlgoExpert.io • References
I have solved quite a number of problems from several topics. See the below table for further details.
Check this [golden](https://tinyurl.com/ujopecz) post.
| # | 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 |
| # | 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 |
| # | 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 |
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 |
| 53 | 1254. Number of Closed Islands | Swift | Art 1, Art 2 | Medium | 📌 BFS, DFS, Union Find |
| # | 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 | --- | --- | --- | --- |
Follow this golden rule to approach any DP problem.
Leetcode problems with solutions and tutorials/videos
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 |
| # | 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 |
100 Problems
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 |
| # | 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 |
| # | 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 |
| # | 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 | --- |
| # | Title | Solution | Tutorial | Level | Remarks |
|---|---|---|---|---|---|
| 01 | Kadane's_Algorithm | Python | |||
| 02 | Topological_Sort | Python | |||
| 03 | KMP_Algorithm | Python |
| # | 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 |
| # | Title | Solution | Tutorial | Level | Remarks |
|---|---|---|---|---|---|
| 01 | Min_Heap_Construction | Python | Video 1 | ||
| 02 | Continuous_Median | Python | Video 1, Video 2 |
| # | 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 |
| # | 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 |
| # | 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 |
| # | 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 |
| # | Title | Solution | Tutorial | Level | Remarks |
|---|---|---|---|---|---|
| 01 | Balanced Bracket | Python | |||
| 02 | Min_Max_Stack_Construction | Python |
| # | 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 |
| # | Title | Solution | Tutorial | Level | Remarks |
|---|---|---|---|---|---|
| 01 | Suffix_Trie_Construction | Python | |||
| 02 | Multi_String_Search | Python |
Check this Golden posts first.
Learn the following modules by heart. Just knowing all of the following items will made most of the problem one-liners.
| Back | FazBrowse Home | New Git URL |