[leetcode] 435.Non-overlapping Intervals

2016-11-25
阅读 2 分钟
2.7k
Given a collection of intervals, find the minimum number of intervalsyou need to remove to make the rest of the intervals non-overlapping. Example 1: Input: [ [1,2], [2,3], [3,4], [1,3] ]Output: 1Explanation: [1,3] can be removed and the rest of intervals arenon-overlapping.

[leetcode] 45.Jump Game II

2016-11-25
阅读 1 分钟
2.4k
Given an array of non-negative integers, you are initially positionedat the first index of the array.Each element in the array represents your maximum jump length at thatposition. Your goal is to reach the last index in the minimum number of jumps. For example: Given array A = [2,3,1,1,4] The min...

[leetcode] 55.Jump Game

2016-11-24
阅读 1 分钟
2k
Given an array of non-negative integers, you are initially positionedat the first index of the array. Each element in the array representsyour maximum jump length at that position. Determine if you are ableto reach the last index. For example: A = [2,3,1,1,4], return true.A = [3,2,1,0,4], return ...

[leetcode] 1.Two Sum

2016-11-24
阅读 1 分钟
1.6k
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution. Example:Given nums = [2, 7, 11, 15], target = 9,Because nums[0] + nums[1] = 2 + 7 = 9,return [0, 1].