Sean Coughlinblog.seancoughlin.me·Jul 2, 2024Mastering LeetCode: Solving the Lowest Common Ancestor of a Binary Tree ProblemSolving the Lowest Common Ancestor of a Binary Tree on LeetCode Introduction Finding the Lowest Common Ancestor (LCA) of two nodes in a binary tree is a classic problem often encountered in coding interviews and algorithm studies. Understanding how t...DiscussSWE Interview Preparationleetcode

Sean Coughlinblog.seancoughlin.me·Jun 29, 2024Rotting Oranges: A Comprehensive Guide to Solving with BFS in PythonIntroduction In this article, we delve into solving the Rotting Oranges problem using the Breadth-First Search (BFS) algorithm in Python. Understanding this problem not only helps in mastering BFS but also enhances problem-solving skills in grid-base...DiscussSWE Interview Preparationleetcode

Tapan Rachchhtapanrachchh.hashnode.dev·Jun 29, 20242192. All Ancestors of a Node in a Directed Acyclic Graphclass Solution: def getAncestors(self, n: int, edges: List[List[int]]) -> List[List[int]]: visited = set() adjList = defaultdict(set) parents = defaultdict(set) # Create adjacency list for (a, b) in edges:...Discussleetcode

Sean Coughlinblog.seancoughlin.me·Jun 28, 2024Mastering LeetCode: Counting the Number of Islands in a 2D Binary GridIntroduction Counting the number of islands in a 2D binary grid is a classic problem that appears frequently in coding interviews (LeetCode 200. Number of Islands). This problem challenges you to identify and count distinct islands in a grid where '1...DiscussSWE Interview PreparationPython

Tapan Rachchhtapanrachchh.hashnode.dev·Jun 28, 20242285. Maximum Total Importance of Roadsclass Solution: def maximumImportance(self, n: int, roads: List[List[int]]) -> int: # Find connections : sort with connection numbers # Assign accordingly d = defaultdict(int) ans = 0 for (a, b) in roads:...Discussleetcode

Tapan Rachchhtapanrachchh.hashnode.dev·Jun 27, 20241791. Find Center of Star Graphclass Solution: def findCenter(self, edges: List[List[int]]) -> int: for x in edges[0]: for y in edges[1]: if x == y: return xDiscussGraph

SANTOSH SINGHsantoshsingh.hashnode.dev·Jun 17, 2024Understanding Kruskal's Algorithm with JavaIntroduction Graph algorithms are a cornerstone of computer science, providing the tools necessary to solve many practical problems, such as network design, circuit design, and much more. Among these algorithms, Kruskal's Algorithm stands out for its...Discuss·1 likeKruskalsAlgorithm

SANTOSH SINGHsantoshsingh.hashnode.dev·May 31, 2024Exploring Depth-First Search (DFS) and Breadth-First Search (BFS) Algorithms with JAVAWhen it comes to traversing or searching through data structures like trees and graphs, two of the most fundamental algorithms are Depth-First Search (DFS) and Breadth-First Search (BFS). These algorithms are foundational in computer science and have...Discuss·1 likeBFS

Sean Coughlinblog.seancoughlin.me·May 7, 2024Mastering the Clone Graph Problem on LeetCode: A Comprehensive GuideIntroduction to the Clone Graph Problem In graph theory, cloning or making a deep copy of a graph (LeetCode 133 Clone Graph) is a fundamental challenge, especially in coding interviews where understanding data structures is crucial. The problem is ty...Discuss·87 readsSWE Interview Preparationleetcode

Sean Coughlinblog.seancoughlin.me·Apr 19, 2024Mastering the 01 Matrix Problem on LeetCode: A Detailed Guide for Aspiring Software EngineersIntroduction to the 01 Matrix Problem In coding interviews, especially on platforms like LeetCode, problems that involve matrices are common as they test a candidate's ability to navigate two-dimensional data structures efficiently. The "01 Matrix" (...Discuss·52 readsSWE Interview PreparationPython