随笔分类 -  String

摘要:You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a conca 阅读全文
posted @ 2016-08-08 02:47 北叶青藤 阅读(214) 评论(0) 推荐(0)
摘要:Given two strings S and T, determine if they are both one edit distance apart. 分析:https://segmentfault.com/a/1190000003906621 虽然我们可以用Edit Distance的解法, 阅读全文
posted @ 2016-08-06 12:42 北叶青藤 阅读(279) 评论(0) 推荐(0)
摘要:Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0. You may assum 阅读全文
posted @ 2016-08-06 05:51 北叶青藤 阅读(204) 评论(0) 推荐(0)
摘要:Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified. You shou 阅读全文
posted @ 2016-08-06 01:47 北叶青藤 阅读(190) 评论(0) 推荐(0)
摘要:Validate if a given string is numeric. Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => true Note: It is intended for the 阅读全文
posted @ 2016-08-05 23:11 北叶青藤 阅读(264) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2016-08-05 11:49 北叶青藤 阅读(239) 评论(0) 推荐(0)
摘要:Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can f 阅读全文
posted @ 2016-08-05 08:11 北叶青藤 阅读(129) 评论(0) 推荐(0)
摘要:Additive number is a string whose digits can form additive sequence. A valid additive sequence should contain at least three numbers. Except for the f 阅读全文
posted @ 2016-08-04 09:12 北叶青藤 阅读(194) 评论(0) 推荐(0)
摘要:Remove Duplicate Letters I Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only on 阅读全文
posted @ 2016-08-04 02:03 北叶青藤 阅读(219) 评论(0) 推荐(0)
摘要:Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assum 阅读全文
posted @ 2016-08-04 01:03 北叶青藤 阅读(191) 评论(0) 推荐(0)
摘要:Given a string, find the longest substring that contains only two unique characters. For example, given "abcbbbbcccbdddadacb", the longest substring t 阅读全文
posted @ 2016-08-03 01:05 北叶青藤 阅读(304) 评论(0) 推荐(0)
摘要:Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-neg 阅读全文
posted @ 2016-08-02 00:45 北叶青藤 阅读(177) 评论(0) 推荐(0)
摘要:You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time 阅读全文
posted @ 2016-08-01 12:21 北叶青藤 阅读(285) 评论(0) 推荐(0)
摘要:Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, i.e.words[i] + 阅读全文
posted @ 2016-08-01 00:32 北叶青藤 阅读(352) 评论(0) 推荐(0)
摘要:All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to 阅读全文
posted @ 2016-07-31 12:46 北叶青藤 阅读(246) 评论(0) 推荐(0)
摘要:Flip Game I Problem Description: You are playing the following Flip Game with your friend: Given a string that contains only these two characters: + a 阅读全文
posted @ 2016-07-30 01:17 北叶青藤 阅读(148) 评论(0) 推荐(0)
摘要:Word Pattern | Given a pattern and a string str, find if str follows the same pattern. Examples: Notes: solution: Split the string, and add the pair t 阅读全文
posted @ 2016-07-29 23:44 北叶青藤 阅读(273) 评论(0) 推荐(0)
摘要:Given a string, we can "shift" each of its letter to its successive letter, for example: "abc" -> "bcd". We can keep "shifting" which forms the sequen 阅读全文
posted @ 2016-07-29 12:04 北叶青藤 阅读(283) 评论(0) 推荐(0)
摘要:Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original list 阅读全文
posted @ 2016-07-28 06:43 北叶青藤 阅读(229) 评论(0) 推荐(0)
摘要:Implement function atoi to convert a string to an integer. If no valid conversion could be performed, a zero value is returned. If the correct value i 阅读全文
posted @ 2016-07-23 05:22 北叶青藤 阅读(221) 评论(0) 推荐(0)