码迷,mamicode.com
首页 >  
搜索关键字:longest substring    ( 5540个结果
hdu 2099 整除的尾数 (java)
问题: 此题java和其它的要求内存要求是一样的,弄了两遍都超时间。 发现一个专门对付杭电最后一个不要空格的方法,String输出: s=s.substring(0,s.length()-1);去掉字符串最后一个字符。。 整除的尾数 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (J...
分类:编程语言   时间:2015-05-29 14:01:21    阅读次数:139
128 Longest Consecutive Sequence
public class Solution { public int longestConsecutive(int[] nums) { HashMap hs = new HashMap(); for (int i : nums) { hs.pu...
分类:其他好文   时间:2015-05-29 11:29:33    阅读次数:109
Longest Common Prefix
public class Solution { public String longestCommonPrefix(String[] strs) { //http://www.cnblogs.com/springfor/p/3872316.html if(strs=...
分类:其他好文   时间:2015-05-29 09:47:20    阅读次数:83
Longest Palindromic Substring
关键在于写好helperpublic class Solution { public String longestPalindrome(String s) { if(s==null) return null; if(s.length()==1) return s; ...
分类:其他好文   时间:2015-05-29 00:51:42    阅读次数:149
Leetcode 3 Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo...
分类:其他好文   时间:2015-05-28 19:59:44    阅读次数:129
Leetcode Longest Common Prefix (排序进行优化)
写完之后看到网上很多人的做法是暴力匹配,其实不用这样的。 我们只要先将字符串排序,那么如果相邻的两个字符串一定前缀匹配度最高,那么我们只需要遍历一遍,每次比较当前字符串和它的前一个字符串的前缀, 得出len,然后取所有len中的最小值即可。 注意特判size为0和1的情况。时间8ms class Solution { public: string longestCommonPref...
分类:编程语言   时间:2015-05-28 18:07:22    阅读次数:182
字符串
字符串:stringLength - 字符串的长度。TrimStart()_TrimEnd()Trim()ToUpper()ToLower()Replace("要被替换的","要去替换的")返回替换后的字符串。Substring(起始位置)Substring(起始位置,截取的长度)IndexOf("...
分类:其他好文   时间:2015-05-28 12:22:24    阅读次数:128
LeetCode【3】.Longest Substring Without Repeating Characters--算法图解及java实现
第三道题Longest Substring Without Repeating Characters如下:      public class Solution { public int lengthOfLongestSubstring(String s) { HashMap hs = new HashMap(); int maxl = 0;...
分类:编程语言   时间:2015-05-28 08:15:38    阅读次数:264
Palindrome Partitioning II -- leetcode
Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning of s. For example, given s = "aab", Return...
分类:其他好文   时间:2015-05-27 17:29:29    阅读次数:130
不区分中英文截断字符串
public static string GetString(this HtmlHelper htmlHelper, string s, int l, string endStr)         {             string temp = s.Substring(0, (s.Length             byte[] encodedBytes = Encoding.A...
分类:其他好文   时间:2015-05-27 17:26:11    阅读次数:146
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!