![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
lintcode
martin_liang
这个作者很懒,什么都没留下…
展开
-
lintcode: Count of Smaller Number
Give you an integer array (index from 0 to n-1, where n is the size of this array, value from 0 to 10000) and an query list. For each query, give you an integer, return the number of element in the ar原创 2017-07-03 23:17:02 · 388 阅读 · 0 评论 -
lintcode:Subsets II
Description Notes Testcase JudgeGiven a list of numbers that may has duplicate numbers, return all possible subsetsHave you met this question in a real interview? Yes N原创 2016-03-27 15:31:43 · 353 阅读 · 0 评论 -
lintcode:Subsets
解法1: 这种需要内部for循环,并且retVtr.push_back是在for循环内部class Solution { private: void subsetsHelper(vector &nums, int curIdx, vector &curVtr, vector> &retVtr) { if (curIdx == nums.size())原创 2016-03-27 13:22:13 · 342 阅读 · 0 评论 -
lintcode:Permutations II
Description Notes Testcase JudgeGiven a list of numbers with duplicate number in it. Find all unique permutations.Have you met this question in a real interview? YesExample原创 2016-03-27 12:17:20 · 457 阅读 · 0 评论 -
lintcode:Heapify
Heapify Description Notes Testcase JudgeGiven an integer array, heapify it into a min-heap array.For a heap array A, A[0] is the root of heap, and for each A[i], A[i * 2 + 1]原创 2016-03-26 17:16:09 · 442 阅读 · 0 评论 -
lintcode:Paint House
Description Notes Testcase JudgeThere are a row of n houses, each house can be painted with one of the three colors: red, blue or green. The cost of painting each house with a certain color原创 2016-03-25 23:51:29 · 363 阅读 · 0 评论 -
leetcode: Next Permutation
Description Notes Testcase JudgeGiven a list of integers, which denote a permutation.Find the next permutation in ascending order.Have you met this question in a real interview?原创 2016-03-25 23:16:33 · 246 阅读 · 0 评论 -
lintcode:First Position of Target
Description Notes Testcase JudgeFor a given sorted array (ascending order) and a target number, find the first index of this number in O(log n) time complexity.If the target number does原创 2016-03-25 10:33:07 · 312 阅读 · 0 评论 -
lintcode: Palindrome Partitioning II
Palindrome Partitioning II 30:00Given a string s, cut s into some substrings such that every substring is a palindrome.Return the minimum cuts needed for a palindrome partiti原创 2016-02-28 15:26:52 · 301 阅读 · 0 评论 -
lintcode:Interleaving Positive and Negative Numbers
Interleaving Positive and Negative NumbersShow result You have exceeded the time limit ResetGiven an array with positive and negative integers. Re-range it to interleavin原创 2016-03-12 00:09:24 · 386 阅读 · 0 评论 -
lintcode:Remove Node in Binary Search Tree
Remove Node in Binary Search Tree You have exceeded the time limitGiven a root of Binary Search Tree with unique value for each node. Remove the node with given value. If there is no原创 2016-02-25 22:57:47 · 434 阅读 · 0 评论 -
lintcode:Unique Binary Search Trees II
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.Have you met this question in a real interview?ExampleGiven n = 3, your program should原创 2016-04-03 22:19:56 · 303 阅读 · 0 评论 -
lintcode: Unique Binary Search Trees
Given n, how many structurally unique BSTs (binary search trees) that store values 1...n?Have you met this question in a real interview?ExampleGiven n = 3, there are a total of 5 uniqu原创 2016-04-03 21:51:24 · 573 阅读 · 0 评论 -
lintcode:Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinct numbers from the original list.Have you met this question in a real interview?ExampleGi原创 2016-04-03 21:04:50 · 251 阅读 · 0 评论 -
lintcode:Sort Colors II
Given an array of n objects with k different colors (numbered from 1 to k), sort them so that objects of the same color are adjacent, with the colors in the order 1, 2, ... k.Have you met this que原创 2016-04-03 20:33:35 · 316 阅读 · 0 评论 -
lintcode:Construct Binary Tree from Preorder and Inorder Traversal
Description Notes Testcase JudgeGiven preorder and inorder traversal of a tree, construct the binary tree.Have you met this question in a real interview? Yes Notice原创 2016-03-27 17:20:42 · 345 阅读 · 0 评论 -
lintcode:First Bad Version
Description Notes Testcase JudgeThe code base version is an integer start from 1 to n. One day, someone committed a bad version in the code case, so it caused this version and the following原创 2016-03-27 17:38:06 · 375 阅读 · 0 评论 -
lintcode: Subarray Sum Closest
Given an integer array, find a subarray with sum closest to zero. Return the indexes of the first number and last number.Have you met this question in a real interview? YesExample原创 2016-03-27 18:52:16 · 420 阅读 · 0 评论 -
lintcode: Insert Delete GetRandom O(1)
Design a data structure that supports all following operations in average O(1)time.insert(val): Inserts an item val to the set if not already present.remove(val): Removes an item val from the se原创 2017-07-02 01:24:52 · 307 阅读 · 0 评论 -
lintcode: Dices Sum
Throw n dices, the sum of the dices' faces is S. Given n, find the all possible value of S along with its probability. NoticeYou do not care about the accuracy of the result, we will help yo原创 2017-07-02 00:11:32 · 365 阅读 · 0 评论 -
lintcode: Partition Equal Subset Sum
Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal. NoticeEach of t原创 2017-06-30 00:47:45 · 337 阅读 · 0 评论 -
Perfect Squares
Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n.Have you met this question in a real interview? Yes原创 2017-06-29 23:34:23 · 253 阅读 · 0 评论 -
lintcode: Palindrome Partitioning
Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.Have you met this question in a real interview?Exa原创 2016-02-28 00:28:04 · 315 阅读 · 0 评论 -
lintcode:Restore IP Addresses
Restore IP Addresses 30:00Given a string containing only digits, restore it by returning all possible valid IP address combinations.Have you met this question in a real inter原创 2016-02-27 23:17:06 · 381 阅读 · 0 评论 -
lintcdoe: Number of Airplanes in the Sky
Number of Airplanes in the Sky 30:00Given an interval list which are flying and landing time of the flight. How many airplanes are on the sky at most?Have you met this questi原创 2016-02-27 23:24:58 · 539 阅读 · 0 评论 -
lintcode:Candy
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 requirements:Each child must have at least on原创 2016-02-25 15:32:51 · 353 阅读 · 0 评论 -
lintcode: Kth Smallest Number in Sorted MatrixShow result
Kth Smallest Number in Sorted MatrixShow result 30:00 StartFind the kth smallest number in at row and column sorted matrix.Have you met this question in a real intervie原创 2016-02-26 00:13:59 · 390 阅读 · 0 评论 -
lintcode:k Sum II
Description Notes Testcase JudgeGiven n unique integers, number k (1Find all possible k integers where their sum is target.Have you met this question in a real interview? Yes原创 2016-03-28 16:06:04 · 345 阅读 · 0 评论 -
lintcode:Reverse Nodes in k-Group
Description Notes Testcase JudgeGiven a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left原创 2016-03-28 14:11:01 · 287 阅读 · 0 评论 -
lintcode:Majority Number II
Description Notes Testcase JudgeGiven an array of integers, the majority number is the number that occursmore than 1/3 of the size of the array.Find it.Have you met this questi原创 2016-03-27 23:48:55 · 282 阅读 · 0 评论 -
lintcdoe:Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list.Analyze and describe its complexity.Have you met this question in a real interview? YesExampleGiven lists:[ 2原创 2016-03-27 19:21:25 · 413 阅读 · 0 评论 -
lintcode: Longest Common Prefix
Longest Common Prefix Description Notes Testcase JudgeGiven k strings, find the longest common prefix (LCP).Have you met this question in a real interview? Yes原创 2016-03-27 17:59:40 · 280 阅读 · 0 评论 -
lintcode:Sort Colors
Given an array with n objects colored red, white orblue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers 0原创 2016-04-03 19:58:09 · 346 阅读 · 0 评论 -
lintcode:String to Integer II
Implement function atoi to convert a string to an integer.If no valid conversion could be performed, a zero value is returned. If the correct value is out of the range of representable values, INT原创 2016-04-03 18:11:40 · 514 阅读 · 0 评论 -
lintcode:Distinct Subsequences
Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be non原创 2015-05-17 12:37:41 · 429 阅读 · 0 评论 -
lintcode:Route Between Two Nodes in Graph
Given a directed graph, design an algorithm to find out whether there is a route between two nodes.ExampleGiven graph:A----->B----->C \ | \ | \ | \ v ->D----->Efo原创 2015-05-17 23:00:50 · 1057 阅读 · 0 评论 -
lintcode:Longest Common Substring
Given two strings, find the longest common substring.Return the length of it.ExampleGiven A="ABCD", B="CBCE", return 2.NoteThe characters in substring should occur continuous原创 2015-05-17 00:34:23 · 530 阅读 · 0 评论 -
lintcode:Recover Rotated Sorted Array
Given a rotated sorted array, recover it to sorted array in-place.Example[4, 5, 1, 2, 3] -> [1, 2, 3, 4, 5]ChallengeIn-place, O(1) extra space and O(n) time.Clarification原创 2015-05-16 22:43:13 · 941 阅读 · 0 评论 -
lintcode:Search Range in Binary Search Tree
Given two values k1 and k2 (where k1 ExampleFor example, if k1 = 10 and k2 = 22, then your function should print 12, 20 and 22. 20 / \ 8 22原创 2015-05-16 22:22:15 · 687 阅读 · 0 评论 -
lintcode:Rotate Image Show result
You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise).ExampleGiven a matrix[ [1,2], [3,4]]rotate it by 90 degrees (clockwise), retu原创 2015-05-13 23:06:40 · 377 阅读 · 0 评论