leetcode string
proudmore
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Leetcode Palindrome partition I,II
Palindrome partition IGiven a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For example, given s = “aab”, Return原创 2015-03-31 12:08:19 · 250 阅读 · 0 评论 -
Leetcode Valid number
public class Solution { public boolean isNumber(String s) { int len = s.length(); int i = 0, e = len - 1; while (i <= e && Character.isWhitespace(s.charAt(i))) i++;原创 2015-06-12 07:47:11 · 253 阅读 · 0 评论 -
Leetcode Shortest palindrome
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 find by performing this transformation.For example:G原创 2015-06-07 04:24:09 · 261 阅读 · 0 评论 -
Leetcode Longest palindrome substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.一个palindrome可以用 if odd, mi原创 2015-06-17 09:08:18 · 289 阅读 · 0 评论 -
Leetcode Compare version numbers
Compare two version numbers version1 and version2. If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0.You may assume that the version strings are non-empty and conta原创 2015-04-30 08:42:05 · 272 阅读 · 0 评论 -
Leetcode Length of last word
Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string. If the last word does not exist, return 0. Note: A word is define原创 2015-03-25 02:29:32 · 211 阅读 · 0 评论 -
Leetcode Word break I, II
Word break IGiven a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. For example, given s = “leetcode”原创 2015-03-31 14:08:57 · 199 阅读 · 0 评论 -
Leetcode Distinct subsequences
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 none)原创 2015-03-29 09:14:43 · 231 阅读 · 0 评论 -
Leetcode Count and say
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 read off as “one 2, t原创 2015-04-02 14:15:13 · 310 阅读 · 0 评论 -
Leetcode Longest valid parentheses
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 “()”, which h原创 2015-03-25 12:52:47 · 190 阅读 · 0 评论 -
Leetcode Interleaving string
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 = “aadbbbaccc”, r原创 2015-03-29 08:41:09 · 257 阅读 · 0 评论 -
Leetcode string and integer 问题
string to integer (atoi) private static final int maxDiv10 = Integer.MAX_VALUE / 10; public int atoi(String str) { int i = 0, n = str.length(); while (i < n && Character.isWhites原创 2015-03-11 09:45:35 · 265 阅读 · 0 评论 -
Leetcode Decode ways
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 total n原创 2015-03-29 02:19:10 · 174 阅读 · 0 评论 -
Leetcode Scramble string
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 / \ gr eat原创 2015-03-29 01:34:27 · 247 阅读 · 0 评论 -
Leetcode string 基础题
字符串的基本题考的就是corner cases,所以要能够自己写出全面的test cases setvalid palindromeGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example, “A man, a原创 2015-03-11 09:29:33 · 219 阅读 · 0 评论 -
Leetcode Edit distance
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 on a word:a) In原创 2015-03-28 06:08:14 · 173 阅读 · 0 评论 -
Leetcode Wildcard matching
Implement wildcard pattern matching with support for ‘?’ and ‘*’. ‘?’ Matches any single character. ‘*’ Matches any sequence of characters (including the empty sequence).The matching should cover原创 2015-03-25 13:55:32 · 246 阅读 · 0 评论 -
Leetcode Regular expression matching
Implement regular expression matching with support for ‘.’ and ‘*’. ‘.’ Matches any single character. ‘*’ Matches zero or more of the preceding element.The matching should cover the entire input原创 2015-03-25 05:00:06 · 202 阅读 · 0 评论
分享