Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.[Solution] 1 TreeNode *sortedListToBST(Li...
分类:
其他好文 时间:
2015-02-16 11:37:14
阅读次数:
126
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:
其他好文 时间:
2015-02-16 11:34:52
阅读次数:
120
近日提交AppSotre的时候,使用Xcode6.1提交几次未果,给出的验证未通过的错误信息如题,百度谷歌无济于事,现分享一下解决办法,供iOS、Mac开发的博友参考。 本人通过苹果的官方开发者论坛,找到了如下帖子:https://devforums.apple.com/message/108...
分类:
移动开发 时间:
2015-02-16 11:31:14
阅读次数:
905
思路就是砍一半, 适用于sorted array.时间复杂度O(lgn).每次都是取中间的跟target比较, 比target小的话目标值肯定在lower和mid之间, 比target大的话在mid和high之间~ 1 public int binarySearch(int num[], int t...
分类:
其他好文 时间:
2015-02-16 11:29:26
阅读次数:
131
Convert Sorted List to Binary Search Tree Total Accepted: 32343 Total Submissions: 117376 My Submissions Question Solution
Given a singly linked list where elements are sorted in ascending order, co...
分类:
编程语言 时间:
2015-02-16 09:04:34
阅读次数:
193
1 public TreeNode sortedListToBST(ListNode head) { 2 if(head==null) return new TreeNode(0); 3 ArrayList arr=new ArrayList(); 4 ...
分类:
编程语言 时间:
2015-02-16 00:20:04
阅读次数:
230
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.
Calling next() will return the next smallest number in the BST.
Note...
分类:
其他好文 时间:
2015-02-15 18:12:12
阅读次数:
175
题目Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".代码public class Solution {
public String addBinary(String a, String b) {
S...
分类:
数据库 时间:
2015-02-15 18:11:30
阅读次数:
220
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ ...
分类:
其他好文 时间:
2015-02-15 16:26:22
阅读次数:
118
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo...
分类:
其他好文 时间:
2015-02-15 14:54:50
阅读次数:
165