- 博客(8)
- 收藏
- 关注
原创 57. Insert Interval & 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].先按start排好序,之后遍历,如果上一个的end大于下一个的start的时候,证明有重叠,修改结果数组
2017-05-28 20:55:59 202
原创 274. H-Index & 275. H-Index II
Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.According to the definition of h-index on Wikipedia: "A
2017-05-28 19:55:03 245
原创 260. Single Number III
Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.For example:Given nums =
2017-05-12 10:16:25 173
原创 263. Ugly Number && 264. Ugly Number II
Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example,6, 8 are ugly while 14 is not ugly since i
2017-05-10 22:06:32 173
原创 416. Partition Equal Subset Sum
Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.Note:Each of the array e
2017-05-04 21:12:26 165
原创 516. Longest Palindromic Subsequence
Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000.Example 1:Input:"bbbab"Output:4One possible longest
2017-05-04 20:50:36 169
原创 338. Counting Bits
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.Example:For num = 5 y
2017-05-04 20:43:07 173
原创 DP一周总结
70. Climbing Stairs 96. Unique Binary Search Trees 338. Counting Bits 416. Partition Equal Subset Sum 516. Longest Palindromic Subsequence 523. Continuous Subarray Sum 感觉DP的主要思路就是首先要把问题抽象化
2017-05-04 20:33:37 198
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人