- 博客(8)
- 资源 (2)
- 收藏
- 关注
原创 有效回文串
lintcode有效回文串 O(n) 时间复杂度,且不占用额外空间。class Solution {public: /** * @param s A string * @return Whether the string is a valid palindrome */ bool isAlpha(char ch) { i
2016-07-31 17:35:18 431
原创 最长公共前缀
lintcode最长公共前缀class Solution {public: /** * @param strs: A list of strings * @return: The longest common prefix */ string getCommonPrefix(string source,string target) {
2016-07-31 14:22:52 456
原创 字符串反转
#include "string"#include "stdio.h"#include "iostream"using namespace std;void myreverse(string &str,int left,int right){ while(left<right) { char temp=str[left]; str[left]
2016-07-31 04:29:04 406
原创 最长公共子串
lintcode练习题目#include "string"#include "stdio.h"#include "iostream"using namespace std;int longestCommonSubstring(string &A, string &B) { int i,j,max=0; int dp[400][400]={0};
2016-07-31 03:52:40 399
原创 乱序字符串算法
乱序字符串蛮力法题目链接:lintcode乱序字符串题目链接 思路等会睡醒之后写吧#include "string"#include "algorithm"#include "stdio.h"#include "iostream"#include "vector"using namespace std;bool Isanagram(string source, string tar
2016-07-31 01:38:40 777
原创 串的模式匹配
串的模式匹配(蛮力法)lintcode字符串查找练习题#include "string.h"#include "stdio.h"char source[100],target[100];int strStr(const char *source, const char *target) { int i,j; i=j=0; if(source==N
2016-07-30 23:19:15 521
原创 关于字符串的算法
串的模式匹配(蛮力法)lintcode字符串查找练习题#include "string.h"#include "stdio.h"char source[100],target[100];int strStr(const char *source, const char *target) { int i,j; i=j=0; if(source==N
2016-07-30 21:16:54 411
原创 平面最近点对问题求解
平面最近点对问题求解问题描述: 最近点对问题是指求解平面点集n个点中距离最近的两个点间的问题。为简单起见,在二维坐标平面来考虑该问题。如果说讨论的点以标准二维坐标给出,则有点和,那么这两点之间的距离。通过这个公式,我们可以计算平面上任意两点之间的距离。本章主要通过两种方法来求解蛮力法分治法1.蛮力法顾名思义,蛮力法指的就是通过遍历所有解之后通过对比求出最近点对问题。 基本思路: 对
2016-07-25 01:30:49 8800 4
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人