LeetCode 340. Longest Substring with At Most K Distinct Characters(java)

Given a string, find the length of the longest substring T that contains at most k distinct characters.For example, Given s = “eceba” and k = 2,T is ...

2018-02-12 11:49:48

阅读数:37

评论数:0

LeetCode 159. Longest Substring with At Most Two Distinct Characters(java)

Given a string, find the length of the longest substring T that contains at most 2 distinct characters.For example, Given s = “eceba”,T is "ece&...

2018-02-12 11:45:26

阅读数:38

评论数:0

LeetCode 3. Longest Substring Without Repeating Characters(java)

Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc&qu...

2018-02-12 02:08:43

阅读数:25

评论数:0

LeetCode 591. Tag Validator(java)

Given a string representing a code snippet, you need to implement a tag validator to parse the code and return whether it is valid. A code snippet is...

2018-02-11 15:50:45

阅读数:17

评论数:0

LeetCode 722. Remove Comments(java)

Given a C++ program, remove comments from it. The program source is an array where source[i] is the i-th line of the source code. This represents the...

2018-02-11 15:39:38

阅读数:49

评论数:0

LeetCode 394. Decode String(java)

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 b...

2018-02-07 12:00:21

阅读数:11

评论数:0

71. Simplify Path(java)

Given an absolute path for a file (Unix-style), simplify it.For example, path = "/home/", => "/home" path = "/a/./b/../.....

2018-02-07 08:56:44

阅读数:15

评论数:0

LeetCode 58. Length of Last Word(java)

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...

2018-02-07 08:40:31

阅读数:10

评论数:0

LeetCode 604. Design Compressed String Iterator(java)

Design and implement a data structure for a compressed string iterator. It should support the following operations: next and hasNext.The given compre...

2018-02-07 08:19:45

阅读数:22

评论数:0

LeetCode 151. Reverse Words in a String(java)

Given an input string, reverse the string word by word.For example, Given s = "the sky is blue", return "blue is sky the".思路:从后向前...

2018-02-06 15:04:13

阅读数:13

评论数:0

LeetCode 68. Text Justification(java)

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...

2018-02-06 13:19:34

阅读数:13

评论数:0

LeetCode 299. Bulls and Cows(java)

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 tim...

2018-02-05 10:47:47

阅读数:6

评论数:0

LeetCode 38. Count and Say(java)

The count-and-say sequence is the sequence of integers with the first five terms as following: 1 11 21 1211 111221 1 is read off as “one 1” or 11. ...

2018-02-05 09:16:36

阅读数:348

评论数:0

LeetCode 383. Ransom Note(java)

Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ran...

2018-02-04 09:46:32

阅读数:17

评论数:0

LeetCode 205. Isomorphic Strings(java)

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 occurrence...

2018-02-03 14:12:03

阅读数:14

评论数:0

LeetCode 161. One Edit Distance(java)

Given two strings S and T, determine if they are both one edit distance apart. 注意:当s和t完全相同时,需要返回false.最快的解法:先调整s和t的长度,使得s的长度小于t,解法中的解决方法很巧妙,通过交换参数,再...

2018-01-22 07:51:43

阅读数:27

评论数:0

LeetCode 72. Edit Distance(java)

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 ...

2018-01-22 07:13:07

阅读数:14

评论数:0

LeetCode 681. Next Closest Time(java)

Given a time represented in the format “HH:MM”, form the next closest time by reusing the current digits. There is no limit on how many times a digit...

2018-01-17 09:55:20

阅读数:195

评论数:0

LeetCode 5. Longest Palindromic Substring(java)

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"Ou...

2018-01-16 05:09:43

阅读数:7

评论数:0

LeetCode -- Google -- Interview Process. 1. Repeated String Match(java)

Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return -1.For...

2018-01-13 14:36:35

阅读数:53

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭