- 博客(9)
- 收藏
- 关注
原创 leetcode 139. Word Break(dp,字典匹配)
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"
2016-09-30 23:26:51 220
原创 leetcode 72. Edit Distance
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:
2016-09-30 21:42:56 282
原创 leetcoed90. Subsets II(集合子集去重)
Given a collection of integers that might contain duplicates, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets.For example,If nums = [1,2,2], a sol
2016-09-30 19:40:57 465
原创 leetcode 78. Subsets(DFS找集合的全部子集)
Given a set of distinct integers, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets.For example,If nums = [1,2,3], a solution is:[ [3], [1],
2016-09-30 10:59:44 589
转载 kmp算法
转自:http://kb.cnblogs.com/page/176818/字符串匹配的KMP算法作者: 阮一峰 发布时间: 2013-08-28 17:12 阅读: 97278 次 推荐: 185 原文链接 [收藏] 字符串匹配是计算机的基本任务之一。 举例来说,有一个字符串"BBC ABCDAB ABCDABCDA
2016-09-24 09:55:13 262
原创 hdu2045 有排成一行的n个方格,用红(Red)、粉(Pink)、绿(Green)三色涂每个格子,每格涂一色,要求任何相邻的方格不能同色,且首尾两格也不同色.求全部的满足要求的涂法.
描述:有排成一行的n个方格,用红(Red)、粉(Pink)、绿(Green)三色涂每个格子,每格涂一色,要求任何相邻的方格不能同色,且首尾两格也不同色.求全部的满足要求的涂法.以上就是著名的RPG难题.Input输入数据包含多个测试实例,每个测试实例占一行,由一个整数N组成,(0Output对于每个测试实例,请输出全部的满足要求的涂法,每个实例的输出占一行。
2016-09-23 21:17:02 6809
原创 48. Rotate Image
You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?Subscribe to see which companies asked this que
2016-09-23 10:59:06 171
原创 将数组中所有小于或等于0的元素都放在数组前面,大于0的元素放在数组后面。要求时间复杂度为o(n)
【编程】对于一个给定的整形数组int array[n]。编程实现:将数组中所有小于或等于0的元素都放在数组前面,大于0的元素放在数组后面。要求时间复杂度为o(n) void Divide(int array[], int n) { int i = 0; for (int j = 0; j { if (array[j] { int temp;
2016-09-20 20:28:55 3067
原创 [算法问题]判断一个数是不是2的幂?
bool Is2Power(int nNum){ return nNum > 0 ? ((nNum & (~nNum + 1)) == nNum ? true : false) : false;}
2016-09-20 19:35:26 546
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人