随笔分类 - 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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:Give an integer array,find the longest increasing continuous subsequence in this array. An increasing continuous subsequence: Can be from right to lef
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文