0%

Balanced Binary Tree – LeetCode 110

Problem

Description

Given a binary tree, determine if it is height-balanced.

For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1.

Read more »

Binary Tree Level Order Traversal II – LeetCode 107

Problem

Description

Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).

Read more »

Maximum Depth of Binary Tree – LeetCode 104

Problem

Description

Given a binary tree, find its maximum depth.

The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.

Read more »

Symmetric Tree – LeetCode 101

Problem

Description

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).

Read more »

Same Tree – LeetCode 100

Problem

Description

Given two binary trees, write a function to check if they are the same or not.

Two binary trees are considered the same if they are structurally identical and the nodes have the same value.

Read more »

Merge Sorted Array – LeetCode 88

Problem

Description

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.

Note:
You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional elements from nums2. The number of elements initialized in nums1 and nums2 are m and n respectively.

Read more »

Remove Duplicates from Sorted List – LeetCode 83

Problem

Description

Given a sorted linked list, delete all duplicates such that each element appear only once.

Read more »

Climbing Stairs – LeetCode 70

Problem

Description

You are climbing a stair case. It takes n steps to reach to the top.

Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

Note: Given n will be a positive integer.

Read more »

Sqrt(x) – LeetCode 69

Problem

Description

Implement int sqrt(int x).

Compute and return the square root of x.

x is guaranteed to be a non-negative integer.

Read more »