随笔分类 -  LintCode

摘要:Given 2*n + 1 numbers, every numbers occurs twice except one, find it. Have you met this question in a real interview? Yes Given 2*n + 1 numbers, ever 阅读全文
posted @ 2016-11-06 13:55 Grandyang 阅读(558) 评论(0) 推荐(0) 编辑
摘要:Given a string, find the length of the longest substring without repeating characters. Have you met this question in a real interview? Yes Given a str 阅读全文
posted @ 2016-10-13 23:58 Grandyang 阅读(884) 评论(0) 推荐(0) 编辑
摘要:Reverse a linked list. Have you met this question in a real interview? Yes Reverse a linked list. Reverse a linked list. Have you met this question in 阅读全文
posted @ 2016-10-11 22:32 Grandyang 阅读(773) 评论(0) 推荐(0) 编辑
摘要:There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. There are two sorted arrays A and B of siz 阅读全文
posted @ 2016-10-10 04:33 Grandyang 阅读(1523) 评论(0) 推荐(0) 编辑
摘要:Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Have you met this question in a real interview? Yes 阅读全文
posted @ 2016-10-08 23:58 Grandyang 阅读(1044) 评论(0) 推荐(0) 编辑
摘要:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get the 阅读全文
posted @ 2016-09-24 09:55 Grandyang 阅读(2458) 评论(2) 推荐(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-09-18 06:33 Grandyang 阅读(1537) 评论(0) 推荐(0) 编辑
摘要:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of 阅读全文
posted @ 2016-09-18 05:33 Grandyang 阅读(1396) 评论(0) 推荐(0) 编辑
摘要:There are n coins with different value in a line. Two players take turns to take one or two coins from left side until there are no more coins left. T 阅读全文
posted @ 2016-09-12 12:15 Grandyang 阅读(3395) 评论(3) 推荐(0) 编辑
摘要:There are n coins in a line. Two players take turns to take one or two coins from right side until there are no more coins left. The player who take t 阅读全文
posted @ 2016-09-11 12:42 Grandyang 阅读(2275) 评论(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-09 21:37 Grandyang 阅读(1786) 评论(0) 推荐(0) 编辑
摘要:Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Return 0 if the array contains less than 2 el 阅读全文
posted @ 2016-09-03 23:58 Grandyang 阅读(1136) 评论(0) 推荐(0) 编辑
摘要:Given a set of n nuts of different sizes and n bolts of different sizes. There is a one-one mapping between nuts and bolts. Comparison of a nut to ano 阅读全文
posted @ 2016-09-02 12:58 Grandyang 阅读(1491) 评论(0) 推荐(0) 编辑
摘要:Find the kth smallest number in at row and column sorted matrix. Have you met this question in a real interview? Yes Find the kth smallest number in a 阅读全文
posted @ 2016-09-01 12:24 Grandyang 阅读(1061) 评论(0) 推荐(0) 编辑
摘要:Given an integer array, find a continuous subarray where the sum of numbers is the biggest. Your code should return the index of the first number and 阅读全文
posted @ 2016-08-30 23:52 Grandyang 阅读(1497) 评论(0) 推荐(0) 编辑
摘要:Given an integer matrix, find a submatrix where the sum of numbers is zero. Your code should return the coordinate of the left-up and right-down numbe 阅读全文
posted @ 2016-08-27 23:58 Grandyang 阅读(2169) 评论(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-26 14:07 Grandyang 阅读(960) 评论(0) 推荐(0) 编辑
摘要:Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is a 阅读全文
posted @ 2016-08-22 06:43 Grandyang 阅读(747) 评论(0) 推荐(0) 编辑
摘要:The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total num 阅读全文
posted @ 2016-08-19 15:08 Grandyang 阅读(720) 评论(0) 推荐(0) 编辑
摘要:There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following re 阅读全文
posted @ 2016-08-17 10:57 Grandyang 阅读(1248) 评论(0) 推荐(0) 编辑

Fork me on GitHub