Jan 6 · 4 min read · 트리나 그래프를 공부하다 보면 항상 함께 등장하는 개념이 있다. DFS / BFS Preorder / Inorder / Postorder 이 둘은 자주 묶여 설명되지만, 실제로는 역할과 레벨이 다르다.이번 글에서는 다음 질문들에 답하는 흐름으로 정리해본다. DFS는 왜 순회 방식이 3가지로 나뉘는가? 순회 코드는 같은데 visit 위치만 다른 건가? BFS에는 왜 preorder / postorder 같은 개념이 없는가? 실무에서...
Join discussionJul 15, 2025 · 4 min read · Problem Statement 695. Max Area of Island Given an m x n binary matrix grid, find the maximum area of an island. An island is a group of 1's connected 4-directionally (horizontal or vertical). The area of an island is the count of 1 cells in that i...
Join discussion
Jul 15, 2025 · 6 min read · When to Use BFS vs DFS Use BFS when: Shortest Path in Unweighted Graphs - BFS guarantees the shortest path because it explores nodes level by level Level-order Traversal - When you need to process nodes level by level Finding Minimum Steps - Any pro...
Join discussion
Jun 20, 2025 · 4 min read · In a Nutshell Typically used on graphs or trees represented as adjacency lists or hash maps. Explores a tree/graph data structure as deep as possible before backtracking. Useful when you want to check if a path exists, not necessarily the shortest...
Join discussionMar 24, 2025 · 2 min read · Day 21: Tackling Binary Tree Problems On Day 21, I focused on solving Medium-level problems related to Binary Trees. These problems helped me strengthen my understanding of DFS, BFS, and recursion. Here’s a quick rundown: Binary Tree Right Side View...
Join discussion
Dec 21, 2024 · 2 min read · Leetcode Question Link: https://leetcode.com/problems/maximum-number-of-k-divisible-components/description/ Intuition Initially, I thought of approaching it with array and tree traversal but didn't think of any other method. I got struck on how to pr...
Join discussion
Nov 11, 2024 · 5 min read · Graphs are powerful data structures used to model relationships in data, from social networks and navigation systems to dependency tracking and recommendation engines. In this guide, we’ll create a graph in TypeScript, implementing basic operations l...
Join discussion
Oct 27, 2024 · 2 min read · Problem Given the root of a binary tree, return the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may not pass through the root. The length of a p...
Join discussion
Oct 19, 2024 · 10 min read · Photo by Cyrus Crossan on Unsplash Algorithmic problem-solving is central to coding interviews, especially for software engineering roles at major tech companies like Google, Facebook, and Amazon. While these challenges might not fully reflect day-to...
Join discussion