47. Permutations II

2019-02-11
阅读 2 分钟
1.4k
Given a collection of numbers that might contain duplicates, return all possible unique permutations.Example:

46. Permutations

2019-02-11
阅读 2 分钟
1.1k
Given a collection of distinct integers, return all possible permutations.

40. Combination Sum II

2019-02-11
阅读 2 分钟
1.6k
Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.Each number in candidates may only be used once in the combination.Note:All numbers (including target) will be positive integers...

39. Combination Sum

2019-02-11
阅读 2 分钟
1.7k
Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.The same repeated number may be chosen from candidates unlimited number of times.Note:All numbers (including targe...

48. Rotate Image

2019-02-11
阅读 2 分钟
1k
You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Note:You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation.Example 1:

49. Group Anagrams

2019-02-11
阅读 1 分钟
1.3k
Note:All inputs will be in lowercase.The order of your output does not matter.

33. Search in Rotated Sorted Array

2019-02-11
阅读 2 分钟
1.3k
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).

34. Find First and Last Position of Element in Sorted Array

2019-02-11
阅读 2 分钟
1.8k
Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is not found in the array, return [-1, -1].

31. Next Permutation

2019-02-11
阅读 2 分钟
1.1k
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order).The replacement must be in-place and use only constant extra m...

24. Swap Nodes in Pairs

2019-02-11
阅读 2 分钟
1.9k
Given a linked list, swap every two adjacent nodes and return its head.You may not modify the values in the list's nodes, only nodes itself may be changed.

22. Generate Parentheses

2019-02-11
阅读 2 分钟
1.3k
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.

19. Remove Nth Node From End of List

2019-02-11
阅读 2 分钟
1k
Given a linked list, remove the n-th node from the end of list and return its head.

18. 4Sum

2019-02-11
阅读 2 分钟
1k
Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.

16. 3Sum Closest

2019-02-11
阅读 2 分钟
1.1k
Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution.

17. Letter Combinations of a Phone Number

2019-02-11
阅读 2 分钟
1.6k
Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.

107. Binary Tree Level Order Traversal II

2019-02-04
阅读 2 分钟
1.4k
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).

104. Maximum Depth of Binary Tree

2019-02-04
阅读 1 分钟
1.4k
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.

101. Symmetric Tree

2019-02-04
阅读 2 分钟
1.1k
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).

100. Same Tree

2019-02-03
阅读 2 分钟
1.3k
Given two binary trees, write a function to check if they are the same or not.

88. Merge Sorted Array

2019-02-03
阅读 1 分钟
1.2k
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.

83. Remove Duplicates from Sorted List

2019-02-03
阅读 1 分钟
1.4k
Given a sorted linked list, delete all duplicates such that each element appear only once.

70. Climbing Stairs

2019-02-03
阅读 1 分钟
1.4k
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?

69. Sqrt(x)

2019-02-03
阅读 1 分钟
1.3k
Compute and return the square root of x, where x is guaranteed to be a non-negative integer.

67. Add Binary

2019-02-03
阅读 1 分钟
1.4k
The input strings are both non-empty and contains only characters 1 or 0.

58. Length of Last Word

2019-02-03
阅读 1 分钟
1.1k
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.

28. Implement strStr()

2019-02-03
阅读 2 分钟
1.1k
Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

66. Plus One

2019-02-03
阅读 2 分钟
1.2k
Given a non-empty array of digits representing a non-negative integer, plus one to the integer.

53. Maximum Subarray

2019-02-03
阅读 1 分钟
1.2k
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.

38. Count and Say

2019-02-03
阅读 2 分钟
1.2k
The count-and-say sequence is the sequence of integers with the first five terms as following:

27. Remove Element

2019-02-02
阅读 2 分钟
1k
Given an array nums and a value val, remove all instances of that value in-place and return the new length.