摘要:Longest Substring Without Repeating Characters leetcode Medium Given a string, find the length of the longest substringwithout repeating characters. E
阅读全文
摘要:令P[1 : n]为1到n(n>1)的整数置换。 设i=1,2,3,4,5,6,7 P[i] = {4,7,3,2,1,5,6},描述P[i]的巡回置换算法。 代码: 为方便观察,多了几步输出。
阅读全文
摘要:URL:https://vjudge.net/problem/HDU-2041 简单DP,因为每次只能走1或者2阶,所以当走到第i阶的时候(i>=4),那么它的前一种状态只可能是i-1和i-2,所以状态方程为: DP[2] = 1; DP[3] = 2; DP[i] = DP[i-1] + DP[i
阅读全文
摘要:HDU 2044 https://vjudge.net/problem/HDU-2044 每一个只有可能由它左面的以及左上的状态变过来,也就是F(i-1)和F(i-2) F(1) = 1 F(2) = 2 F(i) = F(i-1) + F(i-2) (i>=3) AC 代码:
阅读全文
摘要:Basic DP Problem URL:https://vjudge.net/problem/HDU-2018 Describe: There is a cow that gives birth to a heifer every year.Every heifer starts in the f
阅读全文
摘要:HDU 2084:https://vjudge.net/problem/HDU-2084 Problem Describe : When it comes to the DP algorithm, a classic example is the tower problem, which is de
阅读全文
摘要:Problem describe:https://leetcode.com/problems/linked-list-cycle/ Ac Code: (Hash) Fast and Slow Pointer
阅读全文
摘要:Linked Url:https://leetcode.com/problems/single-number/ Given a non-empty array of integers, every element appears twice except for one. Find that sin
阅读全文
摘要:Problem describe:https://leetcode.com/problems/two-sum/ Given an array of integers, return indices of the two numbers such that they add up to a speci
阅读全文
摘要:Given a text file file.txt, print just the 10th line of the file. Example: Assume that file.txt has the following content: Your script should output t
阅读全文