06 2017 档案
摘要:public class Solution { /** * @param nums: A list of integers * @return: A list of integers includes the index of the first number * and the index of the last number ...
阅读全文
摘要:1 public class Solution { 2 /** 3 *@param A: A list of integers 4 *@param elem: An integer 5 *@return: The new length after remove 6 */ 7 public static int removeEl...
阅读全文
摘要:1. 在执行速度方面的比较:StringBuilder > StringBuffer 2. StringBuffer与StringBuilder,他们是字符串变量,是可改变的对象,每当我们用它们对字符串做操作时, 实际上是在一个对象上操作的,不像String一样创建一些对象进行操作,所以速度就快了。
阅读全文
摘要:1 public class Solution { 2 /** 3 * @param s A string 4 * @return the length of last word 5 */ 6 public static int lengthOfLastWord(String s) { 7 if (s == null |...
阅读全文
摘要:1 public class Solution { 2 /** 3 * @param string: An array of Char 4 * @param length: The true length of the string 5 * @return: The true length of new string 6 */ 7 ...
阅读全文
摘要:1 public class Solution { 2 /** 3 * @param s input string 4 * @return the longest palindromic substring 5 */ 6 public static String longestPalindrome(String s) { 7 ...
阅读全文
摘要: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 ...
阅读全文
摘要: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()...
阅读全文
摘要: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[] ...
阅读全文
摘要: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, ...
阅读全文
摘要: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...
阅读全文
摘要: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. ...
阅读全文
摘要:文本编辑 1.光标在屏幕文本中的移动既可以用箭头键,也可以用hjkl字母键。 h 左移 j 下移 k 上移 l 右移 2.欲进入vim编辑器(从命令提示行),请输入:vim 文件名<回车> 3.欲退出vim编辑器,请输入 <Esc> :q! <回车> 放弃所有改动。 或者输入<Esc> :wq <回
阅读全文
摘要: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 ...
阅读全文
摘要: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...
阅读全文
摘要:字符串匹配 "前缀"和"后缀"。 "前缀"指除了最后一个字符以外,一个字符串的全部头部组合;"后缀"指除了第一个字符以外,一个字符串的全部尾部组合。 "部分匹配值"就是"前缀"和"后缀"的最长的共有元素的长度。 next[i]就是前缀数组,下面通过1个例子来看如何构造前缀数组。 例子1:cacca有
阅读全文
摘要:有序数组查找速度比无序数组快 在插入操作中由于所有的数据都需要移动以腾开空间,速度慢 有序数组和无序数组的删除操作都很慢,数据项必须向前移动来填补已删除数据项的洞 有序数组在查找频繁的情况下十分有用,但若是插入和删除较为频繁时,则无法高效工作
阅读全文

浙公网安备 33010602011771号