Leetcode 0111. Minimum Depth of Binary Tree

Posted on Tue 05 November 2024 in Leetcode • Tagged with bfs, binary-tree

Question Link : https://leetcode.com/problems/minimum-depth-of-binary-tree/

Difficulty: Easy

Premium: False

Question

Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. Note: A leaf is a node with no …


Continue reading

Leetcode 0958. Check Completeness of a Binary Tree

Posted on Tue 05 November 2024 in Leetcode • Tagged with binary-tree, bfs

Question Link : https://leetcode.com/problems/check-completeness-of-a-binary-tree/

Difficulty: Medium

Premium: False

Question

Given the root of a binary tree, determine if it is a complete binary tree. In a complete binary tree, every level, except possibly the last, is completely filled, and all nodes in the last level are as …


Continue reading

Leetcode 0133. Clone Graph

Posted on Tue 11 April 2023 in Leetcode • Tagged with dfs, bfs

Question Link : https://leetcode.com/problems/clone-graph/

Difficulty: Medium

Premium: False

Question

Given a reference of a node in a connected undirected graph. Return a deep copy (clone) of the graph. Each node in the graph contains a value (int) and a list (List[Node]) of its neighbors.

class Node …


Continue reading

Leetcode 1466. Reorder Routes to Make All Paths Lead to the City Zero

Posted on Thu 23 March 2023 in Leetcode • Tagged with dfs, bfs

Question Link : https://leetcode.com/problems/reorder-routes-to-make-all-paths-lead-to-the-city-zero/

Difficulty: Medium

Premium: False

Question

There are n cities numbered from 0 to n - 1 and n - 1 roads such that there is only one way to travel between two different cities (this network form a tree). Last year, The ministry of transport …


Continue reading

Leetcode 2492. Minimum Score of a Path Between Two Cities

Posted on Tue 21 March 2023 in Leetcode • Tagged with dfs, bfs, union-find

Question Link : https://leetcode.com/problems/minimum-score-of-a-path-between-two-cities/

Difficulty: Medium

Premium: False

Question

You are given a positive integer n representing n cities numbered from 1 to n. You are also given a 2D array roads where roads[i] = [ai, bi, distancei] indicates that there is a bidirectional road between cities …


Continue reading