Given a string S, find the longest palindromic
substring in S. You may assume that the maximum length of S is 1000, and there
exists one unique longes...
分类:
其他好文 时间:
2014-05-24 04:45:39
阅读次数:
245
题目链接Given a string, find the length of the
longest substring without repeating characters. For example, the longest
substring without repeating letter...
分类:
其他好文 时间:
2014-05-24 02:15:57
阅读次数:
291
Given a binary tree, find its maximum depth.The
maximum depth is the number of nodes along the longest path from the root node
down to the farthest le...
分类:
其他好文 时间:
2014-05-23 11:54:10
阅读次数:
317
用Javascript取float型小数点后两位,例22.127456取成22.13,如何做?
1.这种方法最不推荐:
function get(){
var s = 22.127456 + "";
var str = s.substring(0,s.indexOf(".") + 3);
alert(str);
}
2. 使用正则表达式获取:
function g...
分类:
编程语言 时间:
2014-05-23 08:06:59
阅读次数:
249
找出单词的最长公共前缀
class Solution {
public:
string longestCommonPrefix(vector &strs) {
int len=strs.size();
if(len==0)
return "";
int length=strs[0].size(),j;
...
分类:
其他好文 时间:
2014-05-22 09:35:20
阅读次数:
230
【题目】
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid parentheses substring is "()", which has length = 2.
Another example is ")()())", whe...
分类:
其他好文 时间:
2014-05-20 16:39:07
阅读次数:
280
function getServiceUrl() { var serverUrl =
Xrm.Page.context.getServerUrl(); if (serverUrl.match(/\/$/)) { serverUrl =
serverUrl.substring(0, server...
分类:
其他好文 时间:
2014-05-20 07:40:00
阅读次数:
250
注册成为开发者“App Distribution Guide”中的“Managing
Accounts”会教你如何成注册苹果开发者。学会设计漂亮的应用界面“iOS Human Interface
Guidelines”教你如何设计出遵循iOS用户界面惯例的应用。学习语言“Programming wi...
分类:
其他好文 时间:
2014-05-19 19:25:03
阅读次数:
306
这是一题基础的完全背包,适合初学者来理解完全背包
题意:有 n 种债券可以买 , 每种债券的价格为 w , 每一年的收益为 p , 给你 wi 块钱 , 和 years 年的时间 , 我们最大的收益是是多少?
因为 , 每种债券可以买任意多个 , 所以这是一个简单的完全背包,但是由于基数(体积)太大 , 所以需要优化一下 :
由题意我们知道 , 每种债券的价格都是 10...
分类:
其他好文 时间:
2014-05-18 07:50:38
阅读次数:
251
【题目】
Write a function to find the longest common prefix string amongst an array of strings.
【题意】
求一组字符串的最长公共前缀
【思路】
使用归并思想求解
要求字符串[1,2,..,k,k+1,...n]的最大公共前缀,先分别求[1,2,...k]和[k+1,...,n]的公共前缀...
分类:
其他好文 时间:
2014-05-18 05:17:53
阅读次数:
232