
LeetCode 62. Unique Path Solved (Dynamic Programming)
This is a 2d dynamic programming problem, but it follows the same method of solving we start with a recursive approach, memoize, and finally recognize the pattern to come up with a bottomup iterative approach. If you looked at just the recursive approach it would be hard to tell this is a 2d problem, it’s […]

LeetCode 139. Word Break Solved (Dynamic Programming)
This problem is a pretty standard dynamic programming problem, where you start with a recursive/backtracking solution, memoize it and finally understand the pattern to come up with a bottomup iterative approach. A challenge I face while solving this problem was understanding why memoization was needed because the given examples didn’t seem to need it. But, […]

LeetCode 684. Redundant Connection (UnionFind)
Difficulty: Medium I used 3 approaches for this problem, using DFS, unionfind with sets, and unionfind with an array. Depth First Search The intuition behind my DFS approach is to first create an adjacency list to traverse the graph. Then for each edge in reverse order (since we want to find the extra edge with […]

LeetCode 210. Course Schedule II Solved (Topological Sort)
Difficulty: Medium This problem is a more complete version of the Course Schedule I problem. Topological Sort is used for sorting dependencies, in this problem we have to order courses in a way which we can take them all, and so courses have prerequisites and the prerequisites have prerequisites. This takes the form of a […]

LeetCode 125. Valid Palindrome Solved (Python)
Difficulty: Easy A palindrome is a word that reads the same forward and backward. This problem is a bit different from a normal palindrome check. A normal palindrome check problem can be solved simply by checking if the reverse of the string is the same as the string. Which in python is a simple oneliner: […]