摘要: Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a... 阅读全文
posted @ 2014-05-06 22:20 一弦一仙 阅读(112) 评论(0) 推荐(0) 编辑
摘要: http://oj.leetcode.com/problems/remove-duplicates-from-sorted-array-ii/Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?F... 阅读全文
posted @ 2014-05-06 22:17 一弦一仙 阅读(87) 评论(0) 推荐(0) 编辑
摘要: Binary Tree Inorder TraversalTotal Accepted:16406Total Submissions:47212My SubmissionsGiven a binary tree, return theinordertraversal of its nodes' va... 阅读全文
posted @ 2014-05-06 21:24 一弦一仙 阅读(87) 评论(0) 推荐(0) 编辑
摘要: Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the fir... 阅读全文
posted @ 2014-05-06 21:12 一弦一仙 阅读(106) 评论(0) 推荐(0) 编辑
摘要: http://oj.leetcode.com/problems/reverse-integer/public class Solution { public int reverse(int x) { String strX = Integer.toString(x); ... 阅读全文
posted @ 2014-05-06 20:29 一弦一仙 阅读(130) 评论(0) 推荐(0) 编辑
摘要: http://oj.leetcode.com/problems/same-tree/public class Solution { public boolean isSameTree(TreeNode p, TreeNode q) { Stack pstack = new... 阅读全文
posted @ 2014-05-06 20:17 一弦一仙 阅读(114) 评论(0) 推荐(0) 编辑
摘要: http://oj.leetcode.com/problems/maximum-depth-of-binary-tree/public class Solution { public int maxDepth(TreeNode root) { if(root!=null){ ... 阅读全文
posted @ 2014-05-06 19:50 一弦一仙 阅读(90) 评论(0) 推荐(0) 编辑
摘要: http://oj.leetcode.com/problems/minimum-path-sum/public class Solution { public int minPathSum(int[][] grid) { int row = grid.length; ... 阅读全文
posted @ 2014-05-06 19:40 一弦一仙 阅读(101) 评论(0) 推荐(0) 编辑