- 博客(9)
- 资源 (1)
- 收藏
- 关注
原创 LeetCode: 46. Permutations
Given a collection of distinct numbers, return all possible permutations.For example, [1,2,3] have the following permutations: [ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]
2017-09-13 08:58:16 179
转载 General Approach for backtracking problem
https://leetcode.com/problems/combination-sum/discuss/ A general approach to backtracking questions in Java (Subsets, Permutations, Combination Sum, Palindrome Partitioning) This structure might appl
2017-09-13 04:50:36 297
原创 Leetcode 73. Set Matrix Zeroes
Description: Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.Answer: 1.in-place no extra space: My idea is simple: store states of each row in the first
2017-09-01 00:46:31 127
原创 Leetcode 289. Game of Life
According to the Wikipedia’s article: “The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.”Given a board with m by n ce
2017-09-01 00:01:32 137
原创 Leetcode 162. Find Peak Element
A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain multiple peaks, in that case
2017-08-31 03:32:36 150
原创 Leetcode 287. Find the Duplicate Number
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, fin
2017-08-31 01:09:01 137
原创 Leetcode 56. Merge Intervals
Given a collection of intervals, merge all overlapping intervals.For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18].1.普通sort方法:public List<Interval> merge(List<Interval> inter
2017-08-29 02:23:51 260
原创 Leetcode 189. Rotate Array
Leetcode 189. Rotate ArrayRotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].Note: Try to come up as many
2017-08-28 10:56:25 132
原创 Leetcode 128. Longest Consecutive Sequence:
Leetcode 128. Longest Consecutive Sequence:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example, Given [100, 4, 200, 1, 3, 2], The longest con
2017-08-28 09:09:49 178
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人