Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below a... Read More
posted @ 2014-06-23 11:51 Xylophone Views(132) Comments(0) Diggs(0)
Given a binary tree, return the inorder traversal of its nodes' values.For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3,2]... Read More
posted @ 2014-06-20 11:18 Xylophone Views(129) Comments(0) Diggs(0)
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example, Given n = 3, there are a total of 5 unique BST'... Read More
posted @ 2014-06-20 10:33 Xylophone Views(163) Comments(0) Diggs(0)
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at... Read More
posted @ 2014-06-19 16:27 Xylophone Views(115) Comments(0) Diggs(0)
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted fr... Read More
posted @ 2014-06-19 15:39 Xylophone Views(147) Comments(0) Diggs(0)
Given two sorted integer arrays A and B, merge B into A as one sorted array.Note: You may assume that A has enough space (size that is greater or equa... Read More
posted @ 2014-06-19 15:18 Xylophone Views(107) Comments(0) Diggs(0)
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for... Read More
posted @ 2014-06-19 10:38 Xylophone Views(156) Comments(0) Diggs(0)
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.说明:平衡二叉搜索树,即任何结点的左子树和右子树高度最多相差1的二叉搜索树。二叉搜索树:二叉查找树(Bin... Read More
posted @ 2014-06-18 23:13 Xylophone Views(176) Comments(0) Diggs(0)
Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't mat... Read More
posted @ 2014-06-18 21:35 Xylophone Views(120) Comments(0) Diggs(0)
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or... Read More
posted @ 2014-06-18 21:25 Xylophone Views(123) Comments(0) Diggs(0)