![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
字符串
文章平均质量分 76
sscssz
这个作者很懒,什么都没留下…
展开
-
【LeetCode】504. Base 7【E】【94】
Given an integer, return its base 7 string representation.Example 1:Input: 100Output: "202"Example 2:Input: -7Output: "-10"Note: The input will be in range of [-1e7, 1e原创 2017-02-27 11:06:09 · 465 阅读 · 0 评论 -
【leetcode 题解】415. Add Strings【E】
Given two non-negative numbers num1 and num2 represented as string, return the sum of num1 and num2.Note:The length of both num1 and num2 is Both num1 and num2 contains only digits 0-9.B原创 2016-10-10 14:35:03 · 730 阅读 · 0 评论 -
【leetcode】394. Decode String【M】【45ms】
Given an encoded string, return it's decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note thatk is原创 2016-09-06 22:50:13 · 640 阅读 · 0 评论 -
【leetcode】387. First Unique Character in a String【E】
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:原创 2016-08-23 12:18:25 · 380 阅读 · 0 评论 -
【leetcode】393. UTF-8 Validation【M】
A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules:For 1-byte character, the first bit is a 0, followed by its unicode code.For n-bytes character, the first n-bits原创 2016-09-11 15:21:42 · 1585 阅读 · 0 评论 -
【leetcode】165. Compare Version Numbers【E】【82】
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 co原创 2016-07-06 15:15:52 · 297 阅读 · 0 评论 -
【leetcode】125. Valid Palindrome【E】【92】
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 a原创 2016-07-05 19:48:09 · 341 阅读 · 0 评论 -
350. Intersection of Two Arrays II【E】
Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].Note:Each element in the result should appear as ma原创 2016-05-22 17:11:57 · 789 阅读 · 0 评论 -
187. Repeated DNA Sequences 【M】【30】
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 identify repeated sequences within the DNA.Wri原创 2016-05-09 16:44:01 · 528 阅读 · 0 评论 -
【leetcode】409. Longest Palindrome【E】
Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.This is case sensitive, for example "Aa" is not con原创 2016-10-14 10:00:58 · 432 阅读 · 0 评论 -
【leetcode】438. Find All Anagrams in a String【E】
Given a string s and a non-empty string p, find all the start indices of p's anagrams in s.Strings consists of lowercase English letters only and the length of both strings s and p will not be lar原创 2016-10-27 10:53:41 · 1306 阅读 · 0 评论 -
【leetcode题解】412. Fizz Buzz【E】
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”.原创 2016-10-17 20:08:27 · 834 阅读 · 0 评论 -
【LeetCode】520. Detect Capital【E】【83】
Given a word, you need to judge whether the usage of capitals in it is right or not.We define the usage of capitals in a word to be right when one of the following cases holds:All letters in t原创 2017-02-22 19:03:54 · 611 阅读 · 0 评论 -
【LeetCode】442. Find All Duplicates in an Array【M】【60】
Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements that appear twice in this array.Could you do it without ex原创 2017-02-22 11:02:35 · 387 阅读 · 0 评论 -
【LeetCode】495. Teemo Attacking【M】【41】
In LLP world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo's attacking ascending time series towards Ashe and the poisoning tim原创 2017-02-21 18:45:39 · 601 阅读 · 0 评论 -
【LeetCode】476. Number Complement【E】【59】
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note:The given integer is guaranteed to fit within the range原创 2017-02-17 11:31:16 · 524 阅读 · 0 评论 -
【leetcode】459. Repeated Substring Pattern【E】
Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase Engli原创 2016-11-16 13:30:39 · 847 阅读 · 0 评论 -
【leetcode】419. Battleships in a Board【E】
Given an 2D board, count how many different battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You may assume the following rules:You receiv原创 2016-10-29 00:09:40 · 456 阅读 · 0 评论 -
405. Convert a Number to Hexadecimal【E】【leetcode】
Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used.Note:All letters in hexadecimal (a-f) must be in lowercase.The hexade原创 2016-11-09 15:11:51 · 374 阅读 · 0 评论 -
【leetcode】423. Reconstruct Original Digits from English【M】【95】
Given a non-empty string containing an out-of-order English representation of digits 0-9, output the digits in ascending order.Note:Input contains only lowercase English letters.Input is g原创 2016-10-28 14:29:41 · 476 阅读 · 0 评论 -
72. Edit Distance【H】【65】
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:原创 2016-05-09 16:24:52 · 640 阅读 · 0 评论 -
168. Excel Sheet Column Title 【E】【66】【leetcode】
Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB Credit原创 2016-04-24 15:20:27 · 384 阅读 · 0 评论 -
67. Add Binary【E】【44】【leetcode】
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".Subscribe to see which companies asked this question原创 2016-03-14 23:06:54 · 416 阅读 · 0 评论 -
38. Count and Say【E】【79】【leetcode】
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原创 2016-02-29 20:39:31 · 326 阅读 · 0 评论 -
28. Implement strStr()【E】【59】
Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Subscribe to see which companies asked this question原创 2016-04-06 17:57:27 · 334 阅读 · 0 评论 -
【VIP】205. Isomorphic Strings【E】【61】【太经典了】
Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replaced with anot原创 2016-02-27 20:45:27 · 569 阅读 · 0 评论 -
8. String to Integer (atop)【E】【67】【leetcode】
Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca原创 2016-04-03 13:14:42 · 300 阅读 · 0 评论 -
6. ZigZag Conversion【E】【10】【leetcode】
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原创 2016-04-02 20:24:32 · 288 阅读 · 0 评论 -
【VIP】189. Rotate Array 【E】【85】【leetcode】
Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Note:Try to come up as many solutions as y原创 2016-03-18 16:18:13 · 329 阅读 · 0 评论 -
7. Reverse Integer【E】【27】
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions to ask before cod原创 2016-03-29 20:15:07 · 249 阅读 · 0 评论 -
【重来】【vip】5. Longest Palindromic Substring【m】【30】【97】
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.Subscribe to s原创 2016-04-13 13:12:14 · 1262 阅读 · 0 评论 -
55. Jump Game 【M】【66】
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position. Determine原创 2016-04-28 13:43:06 · 471 阅读 · 0 评论 -
209. Minimum Size Subarray Sum 【M】【35】
Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return 0 instead.For example, given the array [2,3原创 2016-05-11 21:12:46 · 742 阅读 · 0 评论 -
345. Reverse Vowels of a String 【E】
Write a function that takes a string as input and reverse only the vowels of a string.Example 1:Given s = "hello", return "holle".Example 2:Given s = "leetcode", return "leotcede".原创 2016-04-23 17:37:21 · 558 阅读 · 0 评论 -
344. Reverse String [E]
Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".Subscribe to see which companies asked this question原创 2016-04-23 17:06:43 · 340 阅读 · 0 评论 -
349. Intersection of Two Arrays【E】
Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note:Each element in the result must be unique.The res原创 2016-05-18 18:54:41 · 315 阅读 · 0 评论 -
15. 3Sum【M】【28】
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet (a,b,c原创 2016-05-31 14:25:05 · 475 阅读 · 0 评论 -
229. Majority Element II 【M】【52】
Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space.Hint:How many majority elements could it po原创 2016-05-15 15:28:01 · 318 阅读 · 0 评论 -
60. Permutation Sequence 【M】【12】
The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123""132""213""231""312原创 2016-05-13 20:33:30 · 298 阅读 · 0 评论 -
31 Next Permutations【M】【19】
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possible原创 2016-05-13 19:02:39 · 278 阅读 · 0 评论