摘要: 1 public class Solution { 2 /** 3 * @param s A string 4 * @return Whether the string is a valid palindrome 5 */ 6 public static boolean isPalindrome(String s) { 7 ... 阅读全文
posted @ 2017-06-27 17:35 大腮鱼 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 1 public class Solution { 2 /** 3 * @param s : A string 4 * @return : A string 5 */ 6 public static String reverseWords(String s){ 7 if (s == null || s.isEmpty()... 阅读全文
posted @ 2017-06-27 16:49 大腮鱼 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 1 public class Solution { 2 /** 3 * @param str: an array of char 4 * @param offset: an integer 5 * @return: nothing 6 */ 7 public static char[] rotateString(char[] ... 阅读全文
posted @ 2017-06-27 16:02 大腮鱼 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 1 public class Solution { 2 /** 3 * @param A, B: Two string. 4 * @return: the length of the longest common substring. 5 */ 6 public int longestCommonSubstring(String aA, ... 阅读全文
posted @ 2017-06-27 14:56 大腮鱼 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 1 import java.util.ArrayList; 2 import java.util.HashSet; 3 import java.util.List; 4 import java.util.Set; 5 6 /** 7 * Created by cuihongyu on 2017/06/23. 8 */ 9 public class Solution { 1... 阅读全文
posted @ 2017-06-23 17:54 大腮鱼 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 /** 3 * Returns a index to the first occurrence of target in source, 4 * or -1 if target is not part of source. 5 * @param source string to be scanned. ... 阅读全文
posted @ 2017-06-23 15:23 大腮鱼 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 文本编辑 1.光标在屏幕文本中的移动既可以用箭头键,也可以用hjkl字母键。 h 左移 j 下移 k 上移 l 右移 2.欲进入vim编辑器(从命令提示行),请输入:vim 文件名<回车> 3.欲退出vim编辑器,请输入 <Esc> :q! <回车> 放弃所有改动。 或者输入<Esc> :wq <回 阅读全文
posted @ 2017-06-23 14:07 大腮鱼 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 1 public class Solution { 2 /** 3 * @param A : A string includes Upper Case letters 4 * @param B : A string includes Upper Case letter 5 * @return : if string A contains all ... 阅读全文
posted @ 2017-06-22 13:51 大腮鱼 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 1 public class Solution { 2 /** 3 * @param s: The first string 4 * @param b: The second string 5 * @return true or false 6 */ 7 public boolean anagram(String s, S... 阅读全文
posted @ 2017-06-22 11:51 大腮鱼 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 字符串匹配 "前缀"和"后缀"。 "前缀"指除了最后一个字符以外,一个字符串的全部头部组合;"后缀"指除了第一个字符以外,一个字符串的全部尾部组合。 "部分匹配值"就是"前缀"和"后缀"的最长的共有元素的长度。 next[i]就是前缀数组,下面通过1个例子来看如何构造前缀数组。 例子1:cacca有 阅读全文
posted @ 2017-06-22 11:10 大腮鱼 阅读(145) 评论(0) 推荐(0) 编辑