All Posts

Leetcode 515: Find Largest Value in Each Tree Row

Given the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed).

Leetcode 529: Minesweeper

You are playing the game Minesweeper. Given an m x n grid, you must reveal the square corresponding to the next click and update the grid according to Minesweeper’s rules. The grid can contain mines (‘M’), empty squares (‘E’), or revealed squares with adjacent mine counts.

Leetcode 530: Minimum Absolute Difference in BST

Given the root of a Binary Search Tree (BST), return the minimum absolute difference between the values of any two different nodes in the tree.

Leetcode 542: 01 Matrix

Given an m x n binary matrix, return the distance of the nearest 0 for each cell. The distance between two adjacent cells is 1.

Leetcode 547: Number of Provinces

You are given a matrix where each element indicates if two cities are directly connected. Your task is to determine the number of provinces formed by the cities. A province is a group of directly or indirectly connected cities.

Leetcode 617: Merge Two Binary Trees

Given two binary trees, merge them into a new binary tree where overlapping nodes are summed, and non-overlapping nodes are retained as they are.