A. Fake NP(数论水题) Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path. You ...
分类:
其他好文 时间:
2017-05-05 14:13:11
阅读次数:
180
题目: Write a function to find the longest common prefix string amongst an array of strings. 题意: 写出一个函数。找到一组数组中的最长公共子串。 算法分析: 须要构建两重循环。第一层是最短子串的长度,还有一层是 ...
分类:
编程语言 时间:
2017-05-04 21:44:03
阅读次数:
149
2017-05-03 12:05:07 https://www.usnews.com/news/blogs/ken-walshs-washington/2014/10/03/economy-a-two-edged-sword-for-democrats President Obama's lates ...
分类:
其他好文 时间:
2017-05-03 13:09:16
阅读次数:
286
最长无重复字符的子串 第一次提交:没有考虑字符串为空的情形。错误。 第二次提交:AC 思路: 1、判断字符串是否为空,若非空,进行下一步; 2、定义一个 和字符串等长的整形数组 result[] 和一个 字符数组。 整形数组 用于存放从每个字符开始计算 无重复字符子串的长度,字符数组用于存放字符串( ...
分类:
其他好文 时间:
2017-05-02 23:50:57
阅读次数:
350
Write a function to find the longest common prefix string amongst an array of strings. 这个问题是关于如何寻找字符串数组的公共前缀的,从第一个字母开始,只要共有的都要输出。 思路: 1.首先,如何得到字符串共有前缀 ...
分类:
其他好文 时间:
2017-05-02 23:49:13
阅读次数:
445
1.String/Array/Matrix 在Java中,String是一个包含char数组和其它字段、方法的类。如果没有IDE自动完成代码,下面这个方法大家应该记住: String/arrays很容易理解,但与它们有关的问题常常需要高级的算法去解决,例如动态编程、递归等。 下面列出一些需要高级算法 ...
分类:
编程语言 时间:
2017-05-01 19:01:54
阅读次数:
313
Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is defi ...
分类:
其他好文 时间:
2017-04-29 16:12:05
阅读次数:
123
为什么写这一道呢,,, 因为这一道水啊,基础之基础之中的基础啊,,,,然而很简单啊,,, 简单的一道动态规划,最长上升子序列,,,LIS(Longest Increasing Subsequence) dp[i]表示第i个数结尾的最长上升子序列的长度,,,//这里是数值 初始是dp[i]=1;seg ...
分类:
其他好文 时间:
2017-04-28 23:41:12
阅读次数:
219
4月28号 1 5 Longest Palindromic Substring 分奇偶,找最大 public String longestPalindrome(String s) { int n = s.length(); if (n < 2) return s; String res = ""; ...
分类:
其他好文 时间:
2017-04-28 15:55:23
阅读次数:
178