上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 40 下一页
摘要: Print numbers from 1 to the largest number with N digits by recursion. Notice It's pretty easy to do recursion like: recursion(i) { if i > largest num 阅读全文
posted @ 2016-08-18 04:21 amazingzoe 阅读(352) 评论(0) 推荐(0)
摘要: Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek()operation -- it es 阅读全文
posted @ 2016-08-15 10:17 amazingzoe 阅读(119) 评论(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 f 阅读全文
posted @ 2016-08-11 01:45 amazingzoe 阅读(126) 评论(0) 推荐(0)
摘要: Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacen 阅读全文
posted @ 2016-08-10 23:42 amazingzoe 阅读(163) 评论(0) 推荐(0)
摘要: 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 n 阅读全文
posted @ 2016-08-10 05:57 amazingzoe 阅读(143) 评论(0) 推荐(0)
摘要: Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repeating 阅读全文
posted @ 2016-08-10 05:03 amazingzoe 阅读(121) 评论(0) 推荐(0)
摘要: Implement pow(x, n). Runtime: 23ms Analyse: Be aware of corner cases. For exmaple, x = 0, n = 0, n = 1, and n < 0. Note the highlited area, if n == IN 阅读全文
posted @ 2016-08-10 00:03 amazingzoe 阅读(128) 评论(0) 推荐(0)
摘要: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possib 阅读全文
posted @ 2016-08-09 23:47 amazingzoe 阅读(140) 评论(0) 推荐(0)
摘要: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: A 阅读全文
posted @ 2016-08-09 23:19 amazingzoe 阅读(104) 评论(0) 推荐(0)
摘要: Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example,Given n = 3, your program should 阅读全文
posted @ 2016-08-07 06:01 amazingzoe 阅读(150) 评论(0) 推荐(0)
上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 40 下一页