随笔分类 -  Lintcode

摘要:Given an array of integers, find a contiguous subarray which has the largest sum. Notice The subarray should contain at least one number. Example Give 阅读全文
posted @ 2016-08-20 00:21 amazingzoe 阅读(117) 评论(0) 推荐(0)
摘要:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy 阅读全文
posted @ 2016-08-19 03:15 amazingzoe 阅读(82) 评论(0) 推荐(0)
摘要:Convert a binary search tree to doubly linked list with in-order traversal. Have you met this question in a real interview? Yes Convert a binary searc 阅读全文
posted @ 2016-08-18 05:47 amazingzoe 阅读(166) 评论(0) 推荐(0)
摘要:Calculate the an % b where a, b and n are all 32bit integers. Analyse: divide and conquer. Be aware of overflow. Runtime: 12ms 阅读全文
posted @ 2016-08-18 04:57 amazingzoe 阅读(185) 评论(0) 推荐(0)
摘要: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 阅读(351) 评论(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 阅读(127) 评论(0) 推荐(0)