随笔分类 - Leetcode+题
摘要:Say you have an array for which the i th element is the price of a given stock on day i. If you were only permitted to complete at most one transactio
阅读全文
摘要:Given a 2D board containing'X'and'O', capture all regions surrounded by'X'. A region is captured by flipping all'O's into'X's in that surrounded regio
阅读全文
摘要:Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example,Given[100, 4, 200, 1, 3, 2],The longest
阅读全文
摘要:Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For exampl
阅读全文
摘要:Given two binary strings, return their sum (also a binary string). For example,a ="11"b ="1"Return"100". 题意:将两个以字符串形式保存的二进制数进行相加。 思路:其实不管是以数组、字符串形式,加或
阅读全文
摘要:Validate if a given string is numeric. Some examples:"0"=>true" 0.1 "=>true"abc"=>false"1 a"=>false"2e10"=>true Note: It is intended for the problem s
阅读全文
摘要: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
阅读全文
摘要:Given an absolute path for a file (Unix-style), simplify it. For example,path ="/home/", =>"/home"path ="/a/./b/../../c/", =>"/c" click to show corner
阅读全文
摘要:Implement wildcard pattern matching with support for'?'and'*'. 这题和正则表达式匹配有点类似,' . '和本题中的' ? '一样,区别在于' * ',在正则表达式那题中,' * '可以表示之前字符的0个或多个;本题中,可以表示任意字符串。
阅读全文
摘要:Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be in lower-case. 题意:anagrams的意思是回文构词法。回文构词法有一个特点:单词里
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:Implement regular expression matching with support for'.'and'*'. 题意:' . '能匹配任意字符,‘ * ‘表示之前的那个字符可以是0个、1个或者多个,(注意:s= ba和 p= a*bc也是匹配的,*表示p中 * 之前的字符为0个,但
阅读全文
摘要:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo
阅读全文
摘要: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 longes
阅读全文
摘要: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 fo
阅读全文
摘要:You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatena
阅读全文
摘要:Implement strStr(). Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack. 题意:判断一个字符是否在另一个中,若是,则返
阅读全文
摘要:Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-neg
阅读全文
摘要:The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ... 1is read off as"one 1"or11.11is read off as"t
阅读全文

浙公网安备 33010602011771号