上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 17 下一页
摘要: Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be 阅读全文
posted @ 2017-01-05 04:26 lettuan 阅读(248) 评论(0) 推荐(0) 编辑
摘要: Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. Each num 阅读全文
posted @ 2017-01-05 04:11 lettuan 阅读(142) 评论(0) 推荐(0) 编辑
摘要: Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums 阅读全文
posted @ 2017-01-05 04:03 lettuan 阅读(422) 评论(0) 推荐(0) 编辑
摘要: Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ BST's 阅读全文
posted @ 2017-01-05 03:46 lettuan 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 参考例子:[8,3,1,6,4,7,10,14,13] 8,3,1 和 6,4 说明从root开始,沿着左臂向下寻找leaf 的过程中应该逐个将node.val push入ans. 阅读全文
posted @ 2017-01-04 12:11 lettuan 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree [1,null,2,3], return [1,3,2]. 本题如果用recursive的方法非 阅读全文
posted @ 2017-01-04 12:00 lettuan 阅读(87) 评论(0) 推荐(0) 编辑
摘要: Given a binary search tree and a node in it, find the in-order successor of that node in the BST. 本题要求查找p在树中的inorder successor(中序遍历时的下一个节点)。根据p和root的关 阅读全文
posted @ 2017-01-04 11:19 lettuan 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 验证一个list是不是一个BST的preorder traversal sequence。 Given an array of numbers, verify whether it is the correct preorder traversal sequence of a binary sear 阅读全文
posted @ 2017-01-04 06:53 lettuan 阅读(487) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty binary search tree and a target value, find the value in the BST that is closest to the target. Note: Given target value is a floati 阅读全文
posted @ 2017-01-04 05:47 lettuan 阅读(248) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2,2,3] and k = 2, return [1,2]. Note: You may assum 阅读全文
posted @ 2017-01-02 14:07 lettuan 阅读(104) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 17 下一页