描述
There are N children standing in a line. Each child is assigned a rating value.
You are giving candies to these children subjected to the following
...
描述
There are N gas stations along a circular route, where the amount of gas at station i is gas[i].
You have a car with an unlimited gas tank and it c
...
描述
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.
Follow up:Did you use extra space?A straight forward
...
描述
You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Follow up:Could you do this in-place?
分析将矩阵顺时针
...
描述
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total
...
描述
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
...
描述
Given a non-negative number represented as an array of digits, plus one to the number.
The digits are stored such that the most significant digit i
...
描述
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raini
...
描述
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.
The Sudoku board could be partially filled, where empty cells are filled
...
描述
The set [1,2,3,…,n] contains a total of n! unique permutations.
By listing and labeling all of the permutations in order,We get the following seque
...
描述
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such arrangement is not pos
...
描述
Given an array and a value, remove all instances of that value in place and return the new length.
The order of elements can be changed. It doesn’t
...
描述
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array w
...
描述
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three intege
...
描述
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum
...