All Posts

Leetcode 100: Same Tree

You are given two binary trees. Your task is to check if these two trees are the same. Two binary trees are considered the same if they are structurally identical and the nodes have the same value at each corresponding position.

Leetcode 94: Binary Tree Inorder Traversal

Given the root of a binary tree, return the values of its nodes as they appear in an inorder traversal. Inorder traversal visits nodes in the left subtree, the root, and then the right subtree.

Leetcode 95: Unique Binary Search Trees II

Given an integer n, return all structurally unique binary search trees (BSTs) that can be constructed using the integers from 1 to n. Each tree should be a unique arrangement of nodes where each node contains a unique value from the set {1, 2, …, n}.

Leetcode 98: Validate Binary Search Tree

You are given the root of a binary tree. Your task is to determine whether the tree is a valid binary search tree (BST). A binary search tree is valid if for every node in the tree, the value of all nodes in its left subtree are less than its own value, and the value of all nodes in its right subtree are greater than its own value.

Leetcode 99: Recover Binary Search Tree

You are given the root of a binary search tree (BST), but two nodes in the tree were swapped by mistake. Your task is to recover the tree by swapping the two nodes back, without changing the structure of the tree.

Leetcode 102: Binary Tree Level Order Traversal

Given the root of a binary tree, your task is to return the level order traversal of its nodes’ values. This means you should traverse the tree level by level, from left to right at each level.