上一页 1 2 3 4 5 6 ··· 26 下一页
摘要: Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to thedefinition of LCA on Wikipedia: “The lowest ... 阅读全文
posted @ 2015-08-08 19:41 ~每天进步一点点~ 阅读(216) 评论(0) 推荐(0) 编辑
摘要: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipedia: ... 阅读全文
posted @ 2015-08-08 18:34 ~每天进步一点点~ 阅读(242) 评论(0) 推荐(0) 编辑
摘要: Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?/** * Definition for singly-linked l... 阅读全文
posted @ 2015-08-08 18:04 ~每天进步一点点~ 阅读(104) 评论(0) 推荐(0) 编辑
摘要: Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example:Given n = 13,Return 6... 阅读全文
posted @ 2015-08-08 17:32 ~每天进步一点点~ 阅读(103) 评论(0) 推荐(1) 编辑
摘要: Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front o... 阅读全文
posted @ 2015-08-08 16:55 ~每天进步一点点~ 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Given an integer, write a function to determine if it is a power of two.public class Solution { //注意0和负数都返回false!!! /*public boolean isP... 阅读全文
posted @ 2015-08-08 16:38 ~每天进步一点点~ 阅读(180) 评论(0) 推荐(0) 编辑
摘要: Given a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST's tota... 阅读全文
posted @ 2015-08-08 16:15 ~每天进步一点点~ 阅读(97) 评论(0) 推荐(0) 编辑
摘要: Given an integer array of sizen, find all elements that appear more than⌊ n/3 ⌋times. The algorithm should run in linear time and in O(1) space.public... 阅读全文
posted @ 2015-08-08 15:54 ~每天进步一点点~ 阅读(145) 评论(0) 推荐(0) 编辑
摘要: Given a sorted integer array without duplicates, return the summary of its ranges.For example, given[0,1,2,4,5,7], return["0->2","4->5","7"].public cl... 阅读全文
posted @ 2015-08-08 15:16 ~每天进步一点点~ 阅读(116) 评论(0) 推荐(0) 编辑
摘要: Implement a basic calculator to evaluate a simple expression string.The expression string contains onlynon-negativeintegers,+,-,*,/operators and empty... 阅读全文
posted @ 2015-08-08 14:54 ~每天进步一点点~ 阅读(480) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 26 下一页