String
文章平均质量分 71
伊萨卡钢琴家
这个作者很懒,什么都没留下…
展开
-
Leetcode@word search
For this problem, it is a common depth first search problem, and use the visited boolean array to judge if the char element has been visited before. one problem I meet if that start means the number原创 2016-01-20 06:42:53 · 248 阅读 · 0 评论 -
Leetcode 249 Group Shifted Strings
The idea is from this postLeetCode: Group Shifted StringsGiven a string, we can “shift” each of its letter to its successive letter, for example: “abc” -> “bcd”. We can keep “shifting” which原创 2016-01-30 07:21:39 · 494 阅读 · 0 评论 -
Leetcode 299 Bulls and Cows
You are playing the following Bulls and Cows game with your friend: You write a 4-digit secret number and ask your friend to guess it, each time your friend guesses a number, you give a hint, the hint原创 2016-01-30 06:45:53 · 323 阅读 · 0 评论 -
Leetcode 71. Simplify Path
Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"So why we need to change the format of the String addres原创 2016-01-29 23:36:37 · 249 阅读 · 0 评论 -
Leetcode 14. Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.首先找到字符数组中最短的字符长度,然后取第一个字符串,开始从第一个字符开始遍历,如果遇到一个字符不统一,就返回从0到那个字符位置的字符串作为结果public class Solution { public Str原创 2016-01-28 11:29:33 · 264 阅读 · 0 评论 -
Leetcode 316. Remove Duplicate Letters
Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the smallest in lexicographical order a原创 2016-01-27 09:22:05 · 432 阅读 · 0 评论 -
Leetcode 71. Simplify Path
Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"click to show corner cases.Corner Cases:Did原创 2016-01-25 11:25:10 · 246 阅读 · 0 评论 -
Leetcode 151. Reverse Words in a String
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Update (2015-02-12):For C programmers: Try to solve it in-place原创 2016-01-24 12:14:08 · 242 阅读 · 0 评论 -
Leetcode 125. Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not原创 2016-01-24 12:11:01 · 288 阅读 · 0 评论 -
Leetcode 20. Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all va原创 2016-01-24 12:07:07 · 250 阅读 · 0 评论 -
Leetcode 6. ZigZag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I原创 2016-01-24 12:03:56 · 304 阅读 · 0 评论 -
Leetcode 208. Implement Trie (Prefix Tree)
questionLeetcode 208. Implement Trie (Prefix Tree)mplement a trie with insert, search, and startsWith methods.Analysis:For the trie, we need to apply insert, search, and startWith whic原创 2016-01-23 04:18:01 · 285 阅读 · 0 评论 -
Leetcode 200. Number of Islands
Leetcode 200. Number of IslandsGiven a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands hor原创 2016-01-21 04:41:19 · 328 阅读 · 0 评论 -
KMP 算法
This is a String matching algorithm, to match the target string to a txt stringThis is wikidephttp://www.geeksforgeeks.org/searching-for-patterns-set-2-kmp-algorithm/原创 2016-02-14 06:10:52 · 417 阅读 · 0 评论