- 博客(6)
- 收藏
- 关注
原创 Leetcode--65. Valid Number
好吧。。败给这道题了。本来想着直接按空格、加减号、数字、点、数字、e、加减号、数字、空格的顺序处理的,结果发现还是不对,就改为了标记位方法,结果修改倒是好修改了,情况还是不好考虑全!!!改了好几次。Validate if a given string is numeric.Some examples: “0” => true ” 0.1 ” => true “abc” => false “1
2016-11-06 15:58:23 192
原创 Leetcode--62. Unique Paths
Unique Paths A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to r
2016-11-06 14:35:39 204
原创 Leetcode 42. Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,2,1,0,1,3,2,1,2,1], ret
2016-11-04 14:31:28 235
原创 树的三种非递归java实现
*前序: 1、首先访问节点,之后将节点放入栈中,方便后期访问该节点的又节点;之后让遍历节点指向左节点; 2、当当前访问节点为空,说明栈顶左子树已经遍历完毕;此时,出栈,指向出栈右节点;转1*public List<Integer> preorderTraversal(TreeNode root) { ArrayDeque<TreeNode> stack = new ArrayDe
2016-10-19 22:04:58 272
原创 leetcode-- 130. Surrounded Regions
参考:http://blog.csdn.net/worldwindjp/article/details/19251995 Given a 2D board containing ‘X’ and ‘O’ (the letter O), capture all regions surrounded by ‘X’.A region is captured by flipping all ‘O’s int
2016-10-05 21:56:09 193
原创 Leetcode 120. Triangle
Leetcode 120. Triangle For example, given the following triangle [ [2], [3,4], [6,5,7], [4,1,8,3] ] The minimum path sum from top to bottom is 11 (i.e., 2 + 3 + 5 + 1 = 11).思路:
2016-10-01 19:27:11 263
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人