
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: […]