随笔分类 -  Lintcode

摘要:Given an array of integers, find the subarray with smallest sum. Return the sum of the subarray. Notice The subarray should contain one integer at lea 阅读全文
posted @ 2016-09-12 12:39 amazingzoe 阅读(142) 评论(0) 推荐(0)
摘要:Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3].... Notice Please complete the problem in-place. 阅读全文
posted @ 2016-09-08 11:16 amazingzoe 阅读(165) 评论(0) 推荐(0)
摘要:Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list -- whose elements may also be integ 阅读全文
posted @ 2016-09-08 05:54 amazingzoe 阅读(196) 评论(0) 推荐(0)
摘要:Given a non-overlapping interval list which is sorted by start point. Insert a new interval into it, make sure the list is still in order and non-over 阅读全文
posted @ 2016-09-08 04:37 amazingzoe 阅读(191) 评论(0) 推荐(0)
摘要:Design an iterator over a binary search tree with the following rules: Elements are visited in ascending order (i.e. an in-order traversal) next() and 阅读全文
posted @ 2016-09-07 23:53 amazingzoe 阅读(167) 评论(0) 推荐(0)
摘要:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, 阅读全文
posted @ 2016-09-07 09:40 amazingzoe 阅读(177) 评论(0) 推荐(0)
摘要:Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. Given a 2D binary matrix filled with 阅读全文
posted @ 2016-09-07 09:19 amazingzoe 阅读(142) 评论(0) 推荐(0)
摘要:Given a list, each element in the list can be a list or integer. flatten it into a simply list with integers. Notice If the element in the given list 阅读全文
posted @ 2016-09-06 04:53 amazingzoe 阅读(209) 评论(0) 推荐(0)
摘要:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. Notice Bonus point if you 阅读全文
posted @ 2016-09-04 06:58 amazingzoe 阅读(135) 评论(0) 推荐(0)
摘要:There is a fence with n posts, each post can be painted with one of the k colors.You have to paint all the posts such that no more than two adjacent f 阅读全文
posted @ 2016-09-04 06:57 amazingzoe 阅读(162) 评论(0) 推荐(0)
摘要:Give an integer array,find the longest increasing continuous subsequence in this array. An increasing continuous subsequence: Can be from right to lef 阅读全文
posted @ 2016-09-03 23:50 amazingzoe 阅读(110) 评论(0) 推荐(0)
摘要:Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return 阅读全文
posted @ 2016-08-30 03:46 amazingzoe 阅读(153) 评论(0) 推荐(0)
摘要:Given a digit string excluded 01, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on 阅读全文
posted @ 2016-08-29 09:57 amazingzoe 阅读(137) 评论(0) 推荐(0)
摘要:Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges mak 阅读全文
posted @ 2016-08-29 09:15 amazingzoe 阅读(158) 评论(0) 推荐(0)
摘要:Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. How we serialize an undirected graph: Nodes are labele 阅读全文
posted @ 2016-08-29 07:38 amazingzoe 阅读(97) 评论(0) 推荐(0)
摘要:Given string A representative a positive integer which has N digits, remove any k digits of the number, the remaining digits are arranged according to 阅读全文
posted @ 2016-08-25 05:25 amazingzoe 阅读(193) 评论(0) 推荐(0)
摘要:Given a list of non negative integers, arrange them such that they form the largest number. Notice The result may be very large, so you need to return 阅读全文
posted @ 2016-08-25 04:43 amazingzoe 阅读(147) 评论(0) 推荐(0)
摘要:Given n pieces of wood with length L[i] (integer array). Cut them into small pieces to guarantee you could have equal or more than k pieces with the s 阅读全文
posted @ 2016-08-23 20:50 amazingzoe 阅读(155) 评论(0) 推荐(0)
摘要:Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two n 阅读全文
posted @ 2016-08-22 22:13 amazingzoe 阅读(132) 评论(0) 推荐(0)
摘要:Given two strings, find the longest common substring. Return the length of it. Notice The characters in substring should occur continuously in origina 阅读全文
posted @ 2016-08-22 10:06 amazingzoe 阅读(222) 评论(0) 推荐(0)