Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results.Note: The input string may conta...
分类:
其他好文 时间:
2015-12-06 22:25:48
阅读次数:
156
可以借助 stack 一次遍历就将全部有效括号替换为 '.'。 第一步:一次遍历,stack 只存放 '(' 的下标。 当找到一个 '(',则压进 stack ; 当找到一个 ')',则把 stack.top 对于的字符替换为 '.',并弹出 stack.pop()。耗时O(n...
分类:
其他好文 时间:
2015-12-06 17:47:28
阅读次数:
139
Valid PalindromeGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.Example"A man, a plan, a ...
分类:
其他好文 时间:
2015-12-06 17:29:37
阅读次数:
168
题目连接https://leetcode.com/problems/valid-anagram/Valid AnagramDescriptionGiven two strings s and t, write a function to determine if t is an anagram of...
分类:
其他好文 时间:
2015-12-04 22:32:03
阅读次数:
199
Graph Valid TreeGivennnodes labeled from0ton - 1and a list ofundirectededges (each edge is a pair of nodes), write a function to check whether these e...
分类:
其他好文 时间:
2015-12-04 20:53:58
阅读次数:
256
Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ...
分类:
其他好文 时间:
2015-12-04 14:35:01
阅读次数:
118
题目:Givennnodes labeled from0ton - 1and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges make u...
分类:
其他好文 时间:
2015-12-04 12:32:37
阅读次数:
266
Valid SudokuDetermine whether a Sudoku is valid.The Sudoku board could be partially filled, where empty cells are filled with the character ..ExampleT...
分类:
其他好文 时间:
2015-12-04 06:28:28
阅读次数:
148
原题链接在这里:https://leetcode.com/problems/valid-palindrome/注意在用Character.isLetter(s.charAt(i)) 或者 Character.isDigit(s.charAt(i))前需检验 i 是否index out of boun...
分类:
Web程序 时间:
2015-12-03 13:26:38
阅读次数:
144
Determine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with ...
分类:
其他好文 时间:
2015-12-02 22:26:51
阅读次数:
140