这题看起来挺简单的,就是存一个哈希表,然后依次遍历整个字符串,遇到前面有过的字符的时候,就该停止当前计数,新的子串应该从发现该字符的位置的下一位置开始。我开始写了一个简单的写法,发现超时了: if (s.empty()) return 0; if (s.length() == 1) retur.....
分类:
其他好文 时间:
2014-10-10 14:28:10
阅读次数:
160
感觉上MySQL的字符串函数截取字符,比用程序截取(如PHP或JAVA)来得强大,所以在这里做一个记录,希望对大家有用。 函数: 1、从左开始截取字符串 left(str, length) 说明:left(被截取字段,截取长度) 例:select left(content,200) as abstr...
分类:
数据库 时间:
2014-10-10 12:21:44
阅读次数:
324
题目链接:
here
题意:
和hdu4742类似。区别就是一部分三元组是直接给出的。还有一部分是用他给的那个函数生成的。还有就是这里的大于是严格的大于a>b必须ax>bx,ay>by,az>bz。
思路:
思路也和hdu4742here类似。只是有几个比较棘手的问题。现在变成严格大于了。对于y还是很好办的。我们在排序y的时候可以使的标号大的排在前面这样就可以防止y和它一样的更新它了...
分类:
其他好文 时间:
2014-10-10 02:52:43
阅读次数:
235
File file=new File("E:\\aa.jpg");
String fileName=file.getName();
String fileTyle=fileName.substring(fileName.lastIndexOf("."),fileName.length());
System.out.println(fileTyle);
程序运行效果图:...
分类:
编程语言 时间:
2014-10-09 20:49:27
阅读次数:
239
[leetcode]
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring....
分类:
其他好文 时间:
2014-10-09 17:06:08
阅读次数:
187
class Solution: # @return a string def longestCommonPrefix(self, strs): num_items=len(strs) if num_itemslen(i): pre...
分类:
其他好文 时间:
2014-10-09 15:05:24
阅读次数:
179
问题1:fatal error C1083: 无法打开包括文件:“arxHeaders.h”: No such file or directory;解决办法:这个问题很明显,是因为没有在工程属性里包含相关的库目录和头文件目录所致。在包含目录里添上包含目录路径:D:\ObjectARX_2012_Wi...
分类:
其他好文 时间:
2014-10-09 14:24:23
阅读次数:
2482
Problem:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating le...
分类:
其他好文 时间:
2014-10-09 13:49:13
阅读次数:
213
题目描述:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating lette...
分类:
其他好文 时间:
2014-10-09 02:29:17
阅读次数:
178
1.问题描述 给定n种物品和一个背包,物品i的重量是wi,其价值为vi,背包的容量为C。问:应该如何选择装入背包的物品,使得装入背包中物品的总价值最大?2.问题分析 上述问题可以抽象为一个整数规划问题,即求满足 (a)Σwixi≤ C;(b)xi ∈(0,1), 1≤i≤n;条件下,∑vixi最.....
分类:
其他好文 时间:
2014-10-09 01:50:58
阅读次数:
209