Given a binary tree, determine if it is a valid binary search tree (BST).
Assume a BST is defined as follows:
The left subtree of a node contains only nodes with keys less than the node's key.Th...
分类:
其他好文 时间:
2015-04-25 15:11:01
阅读次数:
135
判断合法数字,之前好像在哪里看到过这题,记得当时还写了好久,反正各种改,今天看到了大神的解法(https://github.com/fuwutu/LeetCode/blob/master/Valid%20Number.cpp),用有限状态机,非常简洁,不需要复杂的各种判断!先枚举一下各种合法的输入情...
分类:
其他好文 时间:
2015-04-24 10:30:20
阅读次数:
162
题目Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.For “(()”, the longest valid parentheses substring is “()”, which h...
分类:
其他好文 时间:
2015-04-23 21:49:15
阅读次数:
156
Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ...
分类:
其他好文 时间:
2015-04-23 21:31:47
阅读次数:
127
Given a string containing only digits, restore it by returning all possible valid IP address combinations.
For example:
Given "25525511135",
return ["255.255.11.135", "255.255.111.35"]. (Order...
分类:
其他好文 时间:
2015-04-23 20:00:43
阅读次数:
147
Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only n...
分类:
其他好文 时间:
2015-04-22 23:34:04
阅读次数:
201
最后一个循环的问题比较值得学习,本质是n皇后public class Solution { public boolean isValidSudoku(char[][] board) { //http://blog.csdn.net/linhuanmars/article/deta...
分类:
其他好文 时间:
2015-04-22 08:16:10
阅读次数:
106
第一次用centos7,由于版本太新,所以资料很少,安装过程出现了很多问题,用了很多时间解决过后记录下来,帮助有需要的人。安装vmtools 时提示The path "" is not a valid path to the 3.10.0-229.el7.x86_64 kernel headers....
分类:
其他好文 时间:
2015-04-22 07:05:05
阅读次数:
188
#include#include#include#include#include#include#include#include#include#define LL long longusing namespace std;int map[10][10];int vis[10][10];int a[...
分类:
其他好文 时间:
2015-04-21 22:22:16
阅读次数:
170
Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']',
determine if the input string is valid.
The brackets must close in the correct order, "()" an...
分类:
其他好文 时间:
2015-04-21 20:46:55
阅读次数:
128