原创 LeetCode No.91 Decode Ways

A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... '

原创 LeetCode No.100 Same Tree

Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if

原创 LeetCode No.51 N-Queens

The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.

原创 LeetCode No.80 Remove Duplicates from Sorted Array II

Follow up for "Remove Duplicates": What if duplicates are allowed at most twice? For example, Given sorted array nums

原创 LeetCode No.258 Add Digits

Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Gi

原创 LeetCode No.223 Rectangle Area

Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by its bottom left

原创 LeetCode No.453 Minimum Moves to Equal Array Elements

Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal

原创 LeetCode No.448 Find All Numbers Disappeared in an Array

Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.

原创 LeetCode No.52 N-Queens II

Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct s

原创 LeetCode No.303 Range Sum Query - Immutable

Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Giv

原创 LeetCode No.225 Implement Stack using Queues

Implement the following operations of a stack using queues. push(x) -- Push element x onto stack.pop() -- Removes the

原创 LeetCode No.173 Binary Search Tree Iterator

Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.

原创 LeetCode No.171 Excel Sheet Column Number

Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its correspon

原创 LeetCode No.231 Power of Two

Given an integer, write a function to determine if it is a power of two. ============================================

原创 LeetCode No.168 Excel Sheet Column Title

Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 -> A