【题目】
Given a string S and a string T, count the number of distinct subsequences of T in S.
A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relati...
分类:
其他好文 时间:
2014-06-29 07:27:17
阅读次数:
210
题目
Given a string S and a string T, count the number of distinct subsequences of T in S.
A subsequence of a string is a new string which is formed from the original string by deleting some (can be...
分类:
其他好文 时间:
2014-06-08 14:49:14
阅读次数:
347
原题地址:https://oj.leetcode.com/problems/distinct-subsequences/题意:Given
a stringSand a stringT, count the number of distinct subsequences ofTinS.A
subseq...
分类:
编程语言 时间:
2014-06-06 09:59:43
阅读次数:
330
【题目】
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?
【题意】
有个梯子有n阶,每次只能爬1阶或者2阶,为爬到梯子顶共有多少种爬法
【思路】
依次确定跳到每一阶上的爬法数目
这其实是一...
分类:
其他好文 时间:
2014-06-05 07:16:08
阅读次数:
203
Subsets
Total Accepted: 13267 Total
Submissions: 48509My Submissions
Given a set of distinct integers, S, return all possible subsets.
Note:
Elements in a subset must be in non-desc...
分类:
其他好文 时间:
2014-06-02 10:28:35
阅读次数:
186
题意:在给定的数组里,寻找一个最长的序列,满足ai-2+ai-1=ai。并输出这个序列。很容易想到一个DP方程dp[i][j]=max(dp[k][i])+1.
(a[k]+a[i]==a[j],1=dp[1][5]。这样我们只需要在遍历数组的时候维护数组每个数的最大的下标即可。这里使用hash来做...
分类:
其他好文 时间:
2014-06-02 00:39:39
阅读次数:
379
Common SubsequenceTime Limit: 1000MSMemory Limit:
10000KTotal Submissions: 36542Accepted: 14596DescriptionA subsequence of a
given...
分类:
其他好文 时间:
2014-06-02 00:29:28
阅读次数:
247
问题:
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.
Given an integer n, return all distinct solutions to the n-queens...
分类:
其他好文 时间:
2014-06-01 18:08:28
阅读次数:
334
【题目】
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
For example,
Given 1->2->3->3->4->4->5, return 1->2->5.
Given 1->1->1->2->3, return 2->3.
【题意】
给定一个有序链表,删出其中重复出现的值...
分类:
其他好文 时间:
2014-05-31 21:14:11
阅读次数:
333