dp
mynotwo
这个作者很懒,什么都没留下…
展开
-
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: 4 One possible longest原创 2017-05-04 20:50:36 · 174 阅读 · 0 评论 -
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 · 169 阅读 · 0 评论 -
279. Perfect Squares
Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. For example, given n = 12, return 3 because 12 = 4 + 4 + 4; given n =原创 2017-06-02 09:44:25 · 214 阅读 · 0 评论 -
70. Climbing Stairs
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? //这题根本上来说是一个斐波那契数列。一个台阶有一种方法原创 2016-05-19 14:59:23 · 189 阅读 · 0 评论 -
118. Pascal's Triangle&&119. Pascal's Triangle II
Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ] 解法:没有什么,用一个成员是vec原创 2016-05-23 15:45:43 · 192 阅读 · 0 评论 -
204. Count Primes
Description: Count the number of prime numbers less than a non-negative number, n. 在leetcode上全程看完了hint…… class Solution { public: int countPrimes(int n) { vector isPrime(n,true);原创 2016-05-26 11:14:03 · 148 阅读 · 0 评论