摘要: You are given two jugs with capacities x and y litres. There is an infinite amount of water supply available. You need to determine whether it is poss 阅读全文
posted @ 2016-09-04 14:25 LiBlog 阅读(151) 评论(0) 推荐(0) 编辑
摘要: Given a binary search tree and a node in it, find the in-order successor of that node in the BST. Note: If the given node has no in-order successor in 阅读全文
posted @ 2016-09-04 14:04 LiBlog 阅读(116) 评论(0) 推荐(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 i 阅读全文
posted @ 2016-09-04 13:49 LiBlog 阅读(110) 评论(0) 推荐(0) 编辑
摘要: Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exist one celebrity. The definition of a celebrity is tha 阅读全文
posted @ 2016-09-04 11:34 LiBlog 阅读(87) 评论(0) 推荐(0) 编辑
摘要: Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek() operation -- it e 阅读全文
posted @ 2016-09-04 09:09 LiBlog 阅读(94) 评论(0) 推荐(0) 编辑
摘要: Given two arrays of length m and n with digits 0-9 representing two numbers. Create the maximum number of length k <= m + n from digits of the two. Th 阅读全文
posted @ 2016-09-04 08:57 LiBlog 阅读(217) 评论(0) 推荐(0) 编辑