上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 20 下一页

[Google] Inorder Successor in Binary Search Tree, Solution

摘要: In Binary Tree, Inorder successor of a node is the next node in Inorder traversal of the Binary Tree. Inorder Successor is NULL for the last node in... 阅读全文
posted @ 2013-02-03 04:01 小刀初试 阅读(205) 评论(0) 推荐(0)

[C++ Summary]

摘要: 1. Pass by pointer VS referenceA pointer can receive a NULL parameter, a reference parameter can not. If there's ever a chance that you could want to ... 阅读全文
posted @ 2013-02-03 03:00 小刀初试 阅读(214) 评论(0) 推荐(0)

[Facebook] Products of all elements

摘要: Given an array of numbers, nums, return an array of numbers products, where products[i] is the product of all nums[j], j != i.Input : [1, 2, 3, 4, 5]O... 阅读全文
posted @ 2013-02-01 14:37 小刀初试 阅读(111) 评论(0) 推荐(0)

逻辑题汇总

摘要: 1. 黑帽白帽有一个牢房,有3个犯人关在其中。因为玻璃很厚,所以3个人只能互相看见,不能听到对方说话的声音。”有一天,国王想了一个办法,给他们每个人头上都戴了一顶帽子,只叫他们知道帽子的颜色不是白的就是黑的,不叫他们知道自己所戴帽子的是什么颜色的。在这种情况下,国王宣布两条如下: 1.谁能看到其他... 阅读全文
posted @ 2013-01-31 05:15 小刀初试 阅读(197) 评论(0) 推荐(0)

[FaceBook] Hanoi Moves, Solution

摘要: There are K pegs. Each peg can hold discs in decreasing order of radius when looked from bottom to top of the peg. There are N discs which have radius... 阅读全文
posted @ 2013-01-29 10:50 小刀初试 阅读(149) 评论(0) 推荐(0)

[LeetCode] Decode Ways, Solution

摘要: A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message con... 阅读全文
posted @ 2013-01-28 13:35 小刀初试 阅读(176) 评论(0) 推荐(0)

[LeetCode] Count and Say, Solution

摘要: The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off ... 阅读全文
posted @ 2013-01-28 13:09 小刀初试 阅读(135) 评论(0) 推荐(0)

[LeetCode] Convert Sorted List to Binary Search Tree, Solution

摘要: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.» Solve this problem[Thoughts]It is simil... 阅读全文
posted @ 2013-01-28 12:28 小刀初试 阅读(162) 评论(0) 推荐(0)

[LeetCode] Container With Most Water, Solution

摘要: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo... 阅读全文
posted @ 2013-01-28 11:35 小刀初试 阅读(134) 评论(0) 推荐(0)

[LeetCode] Construct Binary Tree from Preorder and Inorder Traversal, Solution

摘要: Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.» Solve this pr... 阅读全文
posted @ 2013-01-28 10:50 小刀初试 阅读(125) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 20 下一页