lintcode
siriusli_
这个作者很懒,什么都没留下…
展开
-
[Lintcode] 172. Remove Element
172. Remove ElementDescriptionGiven an array and a value, remove all occurrences of that value in place and return the new length.The order of elements can be changed, and the elements after the ne...原创 2019-01-07 20:35:09 · 101 阅读 · 0 评论 -
[Lintcode]124. Longest Consecutive Sequence/[Leetcode]128. Longest Consecutive Sequence
124. Longest Consecutive Sequence/128. Longest Consecutive Sequence本题难度: Medium/HardTopic: Data StructureDescriptionGiven an unsorted array of integers, find the length of the longest consecutiv...原创 2019-02-17 15:14:18 · 97 阅读 · 0 评论 -
[Lintcode]128. Longest Consecutive Sequence/[Leetcode]23. Merge k Sorted Lists
128. Longest Consecutive Sequence / 23. Merge k Sorted Lists本题难度: Hard/MediumTopic: Data StructureDescriptionMerge k sorted linked lists and return it as one sorted list.Analyze and describe it...原创 2019-02-17 16:55:23 · 156 阅读 · 0 评论 -
[Lintcode] 40. Implement Queue by Two Stacks/[Leetcode]225. Implement Stack using Queues
40. Implement Queue by Two Stacks / 225. Implement Stack using Queues本题难度: Medium/EasyTopic: Data Structure - stack/queueDescriptionAs the title described, you should only use two stacks to impl...原创 2019-02-17 20:13:06 · 133 阅读 · 0 评论 -
[Leetcode]225. Implement Stack using Queues
225. Implement Stack using QueuesImplement the following operations of a stack using queues.push(x) – Push element x onto stack.pop() – Removes the element on top of the stack.top() – Get the top ...原创 2019-02-17 20:33:34 · 106 阅读 · 0 评论 -
[Lintcode]12. Min Stack /[Leetcode]155. Min Stack
12. Min Stack / 155. Min Stack本题难度: Medium/EasyTopic: Data StructureDescriptionimport heapqimport collectionsclass MinStack:def __init__(self): """ initialize your data structure here...原创 2019-02-17 21:19:52 · 212 阅读 · 0 评论 -
[Lintcode]4. Ugly Number II/[Leetcode]264. Ugly Number II
4. Ugly Number II / 264. Ugly Number II本题难度: MediumTopic: Data StructureDescriptionUgly number is a number that only have factors 2, 3 and 5.Design an algorithm to find the nth ugly number. The...原创 2019-02-17 22:36:47 · 98 阅读 · 0 评论 -
[Lintcode]132. Word Search II /[Leetcode]212. Word Search II
132. Word Search II / 212. Word Search II本题难度: HardTopic: Data Structure - Tire/DFSDescriptionGiven a 2D board and a list of words from the dictionary, find all words in the board.Each word mus...原创 2019-02-18 22:51:00 · 147 阅读 · 0 评论 -
[Lintcode]120. Word Ladder /[Leetcode]127. Word Ladder
120. Word Ladder / 127. Word Ladder本题难度: Hard/MediumTopic: Data StructureDescriptionGiven two words (start and end), and a dictionary, find the length of shortest transformation sequence from st...原创 2019-03-26 02:15:09 · 127 阅读 · 0 评论 -
[Lintcode]136. Palindrome Partitioning /[Leetcode]131. Palindrome Partitioning
136. Palindrome Partitioning / 131. Palindrome Partitioning本题难度: MediumTopic: Search DFSDescriptionGiven a string s, partition s such that every substring of the partition is a palindrome.Retur...原创 2019-03-27 01:50:27 · 101 阅读 · 0 评论 -
[Lintcode]108. Palindrome Partitioning II /[Leetcode]132. Palindrome Partitioning II
108. Palindrome Partitioning II / 132. Palindrome Partitioning II本题难度: Medium/HardTopic: DPDescriptionGiven a string s, partition s such that every substring of the partition is a palindrome.Re...原创 2019-03-27 02:29:03 · 109 阅读 · 0 评论 -
[Lintcode]115. Unique Paths II/[Leetcode]63. Unique Paths II
#115. Unique Paths II/63. Unique Paths II本题难度: Easy/MediumTopic: Dynamic ProgrammingDescriptionFollow up for “Unique Paths”:Now consider if some obstacles are added to the grids. How many uniqu...原创 2019-03-27 02:37:33 · 138 阅读 · 0 评论 -
[Lintcode]739. 24 Game/[Leetcode]679. 24 Game
#[Lintcode]739. 24 Game/[Leetcode]679. 24 Game本题难度: Hard/Medium## DescriptionYou have 4 cards each containing a number from 1 to 9. You need to judge whether they could operated through*,/,+,...原创 2019-07-15 22:16:32 · 188 阅读 · 0 评论 -
[Lintcode]159. Find Minimum in Rotated Sorted Array
159. Find Minimum in Rotated Sorted ArrayDescriptionSuppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum elem...原创 2019-02-04 18:05:08 · 135 阅读 · 0 评论 -
[Lintcode]138. Subarray Sum
138. Subarray SumDescriptionGiven an integer array, find a subarray where the sum of numbers is zero. Your code should return the index of the first number and the index of the last number.Example...原创 2019-01-07 20:46:37 · 138 阅读 · 0 评论 -
[Lintcode]100. Remove Duplicates from Sorted Array
100. Remove Duplicates from Sorted ArrayDescriptionGiven a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space...原创 2019-01-07 20:59:36 · 149 阅读 · 1 评论 -
[Lintcode]64. Merge Sorted Array
64. Merge Sorted ArrayDescriptionGiven two sorted integer arrays A and B, merge B into A as one sorted array.ExampleA = [1, 2, 3, empty, empty], B = [4, 5]After merge, A will be filled as [1, 2, ...原创 2019-01-07 21:20:11 · 109 阅读 · 0 评论 -
[Lintcode]56. Two Sum
56. Two SumDescriptionTwo SumGiven 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 numbers such that...原创 2019-01-07 21:32:04 · 120 阅读 · 0 评论 -
[Lintcode]50. Product of Array Exclude Itself
50. Product of Array Exclude ItselfDescriptionGiven an integers array A.Define B[i] = A[0] * … * A[i-1] * A[i+1] * … * A[n-1], calculate B WITHOUT divide operation.Out put BExampleFor A = [1, 2, ...原创 2019-01-08 14:27:10 · 120 阅读 · 0 评论 -
[Lintcode]189. First Missing Positive
189. First Missing PositiveDescriptionGiven an unsorted integer array, find the first missing positive integer.ExampleGiven [1,2,0] return 3,and [3,4,-1,1] return 2.ChallengeYour algorithm shou...原创 2019-01-08 15:23:12 · 95 阅读 · 0 评论 -
[Lintcode] 59. 3Sum Closest
59. 3Sum ClosestDescriptionGiven an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers.ExampleFor example,...原创 2019-02-04 00:31:56 · 123 阅读 · 0 评论 -
[lintcode]31. Partition Array
31. Partition ArrayDescriptionGiven an array nums of integers and an int k, partition the array (i.e move the elements in “nums”) such that:All elements < k are moved to the leftAll elements &g...原创 2019-02-04 01:10:25 · 67 阅读 · 0 评论 -
[Lintcode]28. Search a 2D Matrix
28.Search a 2D MatrixDescriptionDescriptionWrite an efficient algorithm that searches for a value in an m x n matrix.This matrix has the following properties:Integers in each row are sorted from ...原创 2019-02-04 01:50:49 · 85 阅读 · 0 评论 -
[Lintcode]60. Search Insert Position
60. Search Insert PositionDescriptionGiven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You ma...原创 2019-02-04 02:01:40 · 126 阅读 · 0 评论 -
[Lintcode]141. Sqrt(x)
141. Sqrt(x)DescriptionSqrt(x)Implement int sqrt(int x).Compute and return the square root of x.ExampleExample 1:Input: 0Output: 0Example 2:Input: 3Output: 1Explanation:return the lar...原创 2019-02-04 02:21:57 · 119 阅读 · 1 评论 -
[Lintcode] 14. First Position of Target
14. First Position of TargetDescriptionFor 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 not ...原创 2019-02-04 17:50:39 · 181 阅读 · 0 评论 -
[Lintcode] 932. Beautiful Array
# [Leetcode:932.Beautiful Array](https://leetcode.com/problems/beautiful-array/)- 本题难度: Hard- Topic:divide-and-conquer# DescriptionFor some fixedN, an arrayAisbeautifulif it is a permuta...原创 2019-07-27 14:47:18 · 127 阅读 · 0 评论