leetcode-string
永不_言败
这个作者很懒,什么都没留下…
展开
-
【leetcode】String——Add Binary(67)
题目:Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".思路:很经典的 "加法进位"问题,判断循环的条件:while(i>=0||j>=0||carry==1)代码:public static St原创 2016-04-11 15:18:52 · 259 阅读 · 0 评论 -
【leetcode】String——Distinct Subsequences(115)
题目:Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be原创 2016-08-14 11:53:48 · 230 阅读 · 0 评论 -
【leetcode】String——Word Ladder II(126)
题目:Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord toendWord, such that:Only one letter can be changed at a t原创 2016-08-13 21:37:11 · 409 阅读 · 0 评论 -
【leetcode】String——Interleaving String(97)
题目:Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", return true.When s3 = "aadbbba原创 2016-06-09 16:04:24 · 319 阅读 · 0 评论 -
【leetcode】String——Scramble String(87)
题目:Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = "great": great / \原创 2016-06-09 11:22:26 · 276 阅读 · 0 评论 -
【leetcode】String——Substring with Concatenation of All Words(30)
题目: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 concatenation of each word in wordsexactly o原创 2016-05-29 21:12:11 · 277 阅读 · 0 评论 -
【leetcode】String——Edit Distance(72)
题目:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted o原创 2016-05-28 23:05:51 · 324 阅读 · 0 评论 -
【leetcode】String——Decode Ways(91)
题目:A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the t原创 2016-05-03 17:45:59 · 325 阅读 · 0 评论 -
【leetcode】String——Letter Combinations of a Phone Number (17)
题目:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:D原创 2016-04-18 16:07:14 · 291 阅读 · 0 评论 -
【leetcode】String——Roman to Integer(13)
题目:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.简述:基本字符IVXLCDM原创 2016-04-17 21:49:27 · 247 阅读 · 0 评论 -
【leetcode】String——Count and Say(38)
题目:The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is rea原创 2016-04-17 12:19:06 · 283 阅读 · 0 评论 -
【leetcode】String——Longest Valid Parentheses(32)
题目:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "原创 2016-05-24 09:36:53 · 314 阅读 · 0 评论 -
【leetcode】String——Restore IP Addresses (93)
题目:Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.135", "255.255.111.35"].原创 2016-04-28 17:32:04 · 335 阅读 · 0 评论 -
【leetcode】String——Basic Calculator II (227)
题目:Implement a basic calculator to evaluate a simple expression string.The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer division原创 2016-04-28 15:25:01 · 297 阅读 · 0 评论 -
【leetcode】String——Palindrome Pairs(336)
题目: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] + words[j] is a palindrome.Example 1:Given原创 2016-08-14 17:04:46 · 344 阅读 · 0 评论