字符串
文章平均质量分 61
_xiaoyuer
世界一定有光
展开
-
LettCode - 5 - Longest Palindromic Substring
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: "babad"Output: "bab"Note: "aba" is also a valid answer.原创 2017-06-22 20:07:03 · 212 阅读 · 0 评论 -
LeetCode - 22 - Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()", "()(())原创 2017-08-11 17:16:07 · 202 阅读 · 0 评论 -
LeetCode - 395 - Longest Substring with At Least K Repeating Characters
Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no less than k times.Example 1:Input:s = "aaabb", k =原创 2017-08-11 17:06:02 · 248 阅读 · 0 评论 -
LeetCode - 242 - Valid Anagram
Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.Note:You may ass原创 2017-08-10 18:00:49 · 202 阅读 · 0 评论 -
LeetCode - 344/541/557 - Reverse String
344. Reverse StringWrite a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".反转一个字符串。时间复杂度O(n),空间复杂度O(1)class Soluti原创 2017-08-10 17:50:00 · 222 阅读 · 0 评论 -
LeetCode - 412 - Fizz Buzz
Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”.原创 2017-08-10 16:59:25 · 216 阅读 · 0 评论 -
LeetCode - 387 - First Unique Character in a String
Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examples:s = "leetcode"return 0.s = "loveleetcode",return 2.Note:原创 2017-08-10 16:52:33 · 251 阅读 · 0 评论 -
LeetCode - 392 - Is Subsequence
Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) strin原创 2017-08-03 15:14:57 · 167 阅读 · 0 评论 -
LeetCode - 599 - Minimum Index Sum of Two Lists
Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings.You need to help them find out their common interest with the原创 2017-07-20 16:42:06 · 202 阅读 · 0 评论 -
LeetCode - 49 - Group Anagrams
Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]]Note: Al原创 2017-08-11 17:33:43 · 224 阅读 · 0 评论