Joined June 2024
34 Photos and videos
Pinned Tweet
Tower of Hanoi - Recursion Visualization
14
241
2,149
385,924
10 Must-Know Graph Algorithms for Coding Interviews: 1. DFS (Depth-First Search) 2. BFS (Breadth-First Search) 3. Topological Sort 4. Union Find (Disjoint Set) 5. Cycle Detection 6. Connected Components 7. Bipartite Check 8. Flood Fill 9. Minimum Spanning Tree 10. Shortest Path (Dijkstra) โ™ป๏ธ Repost to help others in your network
6
130
659
18,980
Basic OOP Concepts Explained with Clear Examples: 1. ๐„๐ง๐œ๐š๐ฉ๐ฌ๐ฎ๐ฅ๐š๐ญ๐ข๐จ๐ง Hide internal data behind public methods. - Example: A BankAccount class keeps balance and pin private. The only way to interact with it is through deposit() and getBalance(). 2. ๐€๐›๐ฌ๐ญ๐ซ๐š๐œ๐ญ๐ข๐จ๐ง Expose a simple interface, hide the complexity behind it. - Example: An EmailService class gives you sendEmail(to, body). Internally, it handles SMTP connections, authentication, and retry logic. The caller doesn't need to know any of that. They just call one method and it works. 3. ๐ˆ๐ง๐ก๐ž๐ซ๐ข๐ญ๐š๐ง๐œ๐ž Let child classes reuse and override behavior from a parent class. - Example: An Animal class defines speak(). Dog extends it and returns "Woof!", Cat extends it and returns "Meow!". Shared logic lives in one place, and each subclass customizes what it needs. 4. ๐๐จ๐ฅ๐ฒ๐ฆ๐จ๐ซ๐ฉ๐ก๐ข๐ฌ๐ฆ Write code that works with multiple types through a common interface. - Example: Define a Shape interface with a draw() method. Now Circle, Rectangle, and Triangle each implement draw() their own way. A single drawShape(Shape s) method works with all of them. โ™ป๏ธ Repost to help others learn this
7
205
1,032
34,987
AlgoMaster.io retweeted
๐‡๐จ๐ฐ ๐ญ๐จ ๐…๐ข๐ง๐ ๐š ๐‚๐ฒ๐œ๐ฅ๐ž ๐ข๐ง ๐š ๐‹๐ข๐ง๐ค๐ž๐ ๐‹๐ข๐ฌ๐ญ Use Floydโ€™s Cycle Detection Algorithm, also known as the slow and fast pointer technique. Start two pointers at the head: - slow moves one step at a time - fast moves two steps at a time If the linked list has no cycle, fast will eventually reach the end. If there is a cycle, fast will eventually catch up with slow inside the loop. Why does this work? Think of two runners on a circular track. If one runs faster than the other, they are guaranteed to meet eventually. Time Complexity: O(n) Space Complexity: O(1)
2
31
188
6,489
AlgoMaster.io retweeted
Tower of Hanoi - Recursion Visualization
14
241
2,149
385,924
15 Must-Know Software Design Patterns: 1. Singleton 2. Factory Method 3. Builder 4. Adapter 5. Decorator 6. Facade 7. Proxy 8. Composite 9. Observer 10. Strategy 11. Command 12. Iterator 13. State 14. Template Method 15. Chain of Responsibility โ™ป๏ธ Repost to help others in your network
9
139
584
17,324
20 must-know DSA patterns for coding interviews: 1. Prefix Sum 2. Two Pointers 3. Sliding Window 4. Fast & Slow Pointers 5. LinkedList In-place Reversal 6. Frequency Counting 7. Monotonic Stack 8. Bit Manipulation 9. Top โ€˜Kโ€™ Elements 10. Overlapping Intervals 11. Binary Search Variants 12. Binary Tree Traversal 13. Depth-First Search (DFS) 14. Breadth-First Search (BFS) 15. Shortest Path 16. Matrix Traversal 17. Backtracking 18. Prefix Search (Trie) 19. Greedy 20. Dynamic Programming Patterns โ™ป๏ธ Repost to help others master coding interviews
4
65
349
11,398
7 Must-Know Big-O Complexities for Coding Interviews: 1. ๐Ž(1) - ๐‚๐จ๐ง๐ฌ๐ญ๐š๐ง๐ญ ๐ญ๐ข๐ฆ๐ž - The runtime doesn't change regardless of the input size. - Example: Accessing an element in an array by its index. 2. ๐Ž(๐ฅ๐จ๐  ๐ง) - ๐‹๐จ๐ ๐š๐ซ๐ข๐ญ๐ก๐ฆ๐ข๐œ ๐ญ๐ข๐ฆ๐ž - The runtime grows slowly as the input size increases. Typically seen in algorithms that divide the problem in half with each step. - Example: Binary search in a sorted array. 3. ๐Ž(๐ง) - ๐‹๐ข๐ง๐ž๐š๐ซ ๐ญ๐ข๐ฆ๐ž - The runtime grows linearly with the input size. - Example: Finding an element in an array by iterating through each element. 4. ๐Ž(๐ง ๐ฅ๐จ๐  ๐ง) - ๐‹๐ข๐ง๐ž๐š๐ซ๐ข๐ญ๐ก๐ฆ๐ข๐œ ๐ญ๐ข๐ฆ๐ž - The runtime grows slightly faster than linear time. It involves a logarithmic number of operations for each element in the input. - Example: Sorting an array using quick sort or merge sort. 5. ๐Ž(๐ง^2) - ๐๐ฎ๐š๐๐ซ๐š๐ญ๐ข๐œ ๐ญ๐ข๐ฆ๐ž - The runtime grows proportionally to the square of the input size. - Example: Bubble sort algorithm which compares and potentially swaps every pair of elements. 6. ๐Ž(2^๐ง) - ๐„๐ฑ๐ฉ๐จ๐ง๐ž๐ง๐ญ๐ข๐š๐ฅ ๐ญ๐ข๐ฆ๐ž - The runtime doubles with each addition to the input. These algorithms become impractical for larger input sizes. - Example: Generating all subsets of a set. 7. ๐Ž(๐ง!) - ๐…๐š๐œ๐ญ๐จ๐ซ๐ข๐š๐ฅ ๐ญ๐ข๐ฆ๐ž - Runtime is proportional to the factorial of the input size. - Example: Generating all permutations of a set. โ™ป๏ธ Repost to help others learn this
5
154
787
35,968
๐‡๐จ๐ฐ ๐Œ๐ž๐ซ๐ ๐ž ๐’๐จ๐ซ๐ญ ๐–๐จ๐ซ๐ค๐ฌ Merge Sort is a classic Divide & Conquer algorithm. Hereโ€™s the idea: - Divide โ†’ Split the array into two halves - Conquer โ†’ Recursively sort both halves - Combine โ†’ Merge the sorted halves into one sorted array The magic lies in the merge step, where two sorted arrays are combined efficiently in linear time. Time Complexity: O(n log n) (always) Quick example: [5, 2, 4, 1] โ†’ [5, 2] [4, 1] โ†’ [2, 5] [1, 4] โ†’ [1, 2, 4, 5] โ™ป๏ธ Repost to help others in your network
6
51
2,489
How Bubble Sort Works
8
59
8,098
14 must-know Data Structures for coding interviews: 1. Array 2. Queue 3. Deque 4. Matrix 5. Stack 6. Binary Tree 7. Linked List 8. Doubly Linked List 9. HashMap 10. Binary Search Tree (BST) 11. Heap (Priority Queue) 12. Trie 13. Graph 14. Union Find โ™ป๏ธ Repost to help others in your network
9
356
1,833
69,175
10 must-know Array patterns for coding interviews: 1. Two Pointers 2. Sliding Window 3. Prefix Sum 4. Kadane's Algorithm 5. Binary Search 6. Cyclic Sort 7. Merge Intervals 8. Monotonic Stack 9. Hash Map Lookup 10. Sorting Greedy โ™ป๏ธ Repost to help others in your network
8
44
236
8,996
If you want to master dynamic programming for coding interviews, learn these 20 patterns: 1. Fibonacci Numbers 2. 0/1 Knapsack 3. Unbounded Knapsack 4. Longest Common Subsequence 5. Longest Increasing Subsequence 6. Palindromic Subsequence 7. Matrix Chain 8. Edit Distance 9. Coin Change 10. Kadane's Algorithm 11. Grid Paths 12. Subset Sum 13. Rod Cutting 14. Climbing Stairs 15. House Robber 16. Interval DP 17. State Machine DP 18. Tree DP 19. Bitmask DP 20. Digit DP โ™ป๏ธ Repost to help others in your network
4
67
338
11,059
Top 15 Design Patterns You Should Know: 1. Singleton 2. Factory Method 3. Builder 4. Adapter 5. Decorator 6. Facade 7. Proxy 8. Composite 9. Observer 10. Strategy 11. Command 12. Iterator 13. State 14. Template Method 15. Chain of Responsibility Which design pattern do you use the most in your work?
9
141
617
19,796
๐‡๐จ๐ฐ ๐ƒ๐ž๐ฉ๐ญ๐ก-๐…๐ข๐ซ๐ฌ๐ญ ๐’๐ž๐š๐ซ๐œ๐ก (๐ƒ๐…๐’) ๐–๐จ๐ซ๐ค๐ฌ: 1. ๐’๐ญ๐š๐ซ๐ญ ๐ฐ๐ข๐ญ๐ก ๐š ๐ฌ๐ญ๐š๐œ๐ค: Push the source node onto a stack. Mark it as visited. 2. ๐๐จ๐ฉ ๐ญ๐ก๐ž ๐ญ๐จ๐ฉ ๐ง๐จ๐๐ž: Take the top element from the stack. This is the node you are currently exploring. 3. ๐๐ซ๐จ๐œ๐ž๐ฌ๐ฌ ๐ญ๐ก๐ž ๐ง๐จ๐๐ž: Do whatever the problem requires: print it, check a condition, record the path. 4. ๐๐ฎ๐ฌ๐ก ๐ฎ๐ง๐ฏ๐ข๐ฌ๐ข๐ญ๐ž๐ ๐ง๐ž๐ข๐ ๐ก๐›๐จ๐ซ๐ฌ: Look at all neighbors of the current node. For each one that has not been visited, mark it as visited and push it onto the stack. 5. ๐‘๐ž๐ฉ๐ž๐š๐ญ ๐ฎ๐ง๐ญ๐ข๐ฅ ๐ญ๐ก๐ž ๐ฌ๐ญ๐š๐œ๐ค ๐ข๐ฌ ๐ž๐ฆ๐ฉ๐ญ๐ฒ: Go back to step 2. Each iteration goes deeper down one path before backtracking. 6. ๐๐š๐œ๐ค๐ญ๐ซ๐š๐œ๐ค๐ข๐ง๐  ๐ก๐š๐ฉ๐ฉ๐ž๐ง๐ฌ ๐ง๐š๐ญ๐ฎ๐ซ๐š๐ฅ๐ฅ๐ฒ: When a node has no unvisited neighbors, you do not push anything. The next pop takes you back up the path. โ™ป๏ธ Repost to help others in your network
2
33
217
9,227