Skip to content

๐Ÿ‘จโ€๐Ÿ’ป This repository contains the solutions and explanations to the algorithm problems on LintCode. All are written in Python/Java/C++ and implemented by myself.

License

Notifications You must be signed in to change notification settings

Zhenye-Na/lintcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

LintCode Online Judge

457.Classical Binary Search
14.First Position of Target
458.Last Position of Target
61.Search for a Range
74.First Bad Version
447.Search in a Big Sorted Array
60.Search Insert Position
28.Search a 2D Matrix
38.Search a 2D Matrix II (M)
462.Total Occurrence of Target
585.Maximum Number in Mountain Sequence
75.Find Peak Element
141.Sqrt(x)
586.Sqrt(x) II
248.Count of Smaller Number (M)
159.Find Minimum in Rotated Sorted Array
160.Find Minimum in Rotated Sorted Array II
62.Search in Rotated Sorted Array (M)
460.Find K Closest Elements (k closest numbers in sorted array)
65.Median of two Sorted Arrays (H)
249.Count of Smaller Number before itself (H)
183.Wood Cut (H)
437.Copy Books (H)
600.Smallest Rectangle Enclosing Black Pixels (H)
940.Maximum Absolute Value (M)
1626.Salary Adjustment (M)

Divide and Conquer

66.Binary Tree Preorder Traversal
67.Binary Tree Inorder Traversal
68.Binary Tree Postorder Traversal
97.Maximum Depth of Binary Tree
480.Binary Tree Paths
596.Minimum Subtree
628.Maximum Subtree
93.Balanced Binary Tree
597.Subtree with Maximum Average
453.Flatten Binary Tree to Linked List
88.Lowest Common Ancestor of a Binary Tree (M)
474.Lowest Common Ancestor II
578.Lowest Common Ancestor III (M)
595.Binary Tree Longest Consecutive Sequence
614.Binary Tree Longest Consecutive Sequence II (M)
619.Binary Tree Longest Consecutive Sequence III (M)
94.Binary Tree Maximum Path Sum (M)
376.Binary Tree Path Sum
246.Binary Tree Path Sum II
472.Binary Tree Path Sum III (H)
863.Binary Tree Path Sum IV (M)
378.Convert Binary Tree to Doubly Linked List (M)
650.Find Leaves of Binary Tree

Binary Search Tree

95.Validate Binary Search Tree (M)
86.Binary Search Tree Iterator (H)
448.Inorder Successor in BST (M)
11.Search Range in Binary Search Tree (M)
85.Insert Node in a Binary Search Tree
87.Remove Node in Binary Search Tree (H)

69.Binary Tree Level Order Traversal
7.Serialize and Deserialize Binary Tree
71.Binary Tree Zigzag Level Order Traversal
70.Binary Tree Level Order Traversal II
242.Convert Binary Tree to Linked Lists by Depth
178.Graph Valid Tree
137.Clone Graph
618.Search Graph Nodes
127.Topological Sorting
615.Course Schedule
616.Course Schedule II
605.Sequence Reconstruction
433.Number of Islands
677.Number of Big Islands
598.Zombie in Matrix
611.Knight Shortest Path
573.Build Post Office II
431.Connected Component in Undirected Graph
120.Word Ladder (H)
121.Word Ladder II (H)
630.Knight Shortest Path II (M)
1446.01 Matrix Walking Problem (M)
375.Clone Binary Tree
477.Surrounded Regions

15.Permutations (M)
16.Permutations II (M)
17.Subsets (M)
18.Subsets II (M)
152.Combinations (M)
135.Combination Sum (M)
153.Combination Sum II (M)
425.Letter Combinations of a Phone Number (M)
426.Restore IP Addresses (M)
136.Palindrome Partitioning (M)
121.Word Ladder II (H)
52.Next Permutation
190.Next Permutation II
33.N-Queens
790.Parser
652.Factorization
1353.Sum Root to Leaf Numbers
1031.Is Graph Bipartite

450.Reverse Nodes in k-Group
165.Merge Two Sorted Lists
36.Reverse Linked List II
511.Swap Two Nodes in Linked List
98.Sort List
99.Reorder List
170.Rotate List
96.Partition List
105.Copy List with Random Pointer
102.Linked List Cycle
103.Linked List Cycle II (H)
380.Intersection of Two Linked Lists
106.Convert Sorted List to Binary Search Tree
372.Delete Node in a Linked List

41.Maximum Subarray
604.Window Sum
138.Subarray Sum
139.Subarray Sum Closest
547.Intersection of Two Arrays (3 approaches)

100.Remove Duplicates from Sorted Array
101.Remove Duplicates from Sorted Array II
39.Recover Rotated Sorted Array
64.Merge Sorted Array
6.Merge Two Sorted Arrays (Merge Sorted Array II)
49.Sort Letters by Case
148.Sort Colors
143.Sort Colors II
144.Interleaving Positive and Negative Numbers
373.Partition Array by Odd and Even
415.Valid Palindrome
461.Kth Smallest Numbers in Unsorted Array
521.Remove Duplicate Numbers in Array
539.Move Zeroes
56.Two Sum
57.3-Sum
58.4Sum
59.3-Sum Closest
533.Two Sum - Closest to target 607.Two Sum III - Data structure design
587.Two Sum - Unique pairs
609.Two Sum - Less than or equal to target
443.Two Sum - Greater than target
610.Two Sum - Difference equals to target
32.Minimum Window Substring
384.Longest Substring Without Repeating Characters
386.Longest Substring with At Most K Distinct Characters
406.Minimum Size Subarray Sum
461.Kth Smallest Numbers in Unsorted Array
363.Trapping Rain Water
1487.Judging Triangle

575.Decode String (Expression Expand)
494.Implement Stack by Two Queues
40.Implement Queue by Two Stacks
224.Implement Three Stacks by Single Array (M)
955.Implement Queue by Circular Array
12.Min Stack (Monotonic Stack) (M)
122.Largest Rectangle in Histogram (H)
510.Maximal Rectangle (H)
126.Max Tree (H)

Iterator ็›ธๅ…ณ้ข˜

528.Flatten Nested List Iterator
540.Zigzag Iterator
541.Zigzag Iterator II
601.Flatten 2D Vector

129.Rehashing
134.LRU Cache
105.Copy List with Random Pointer
171.Anagrams
124.Longest Consecutive Sequence

104.Merge K Sorted Lists
1272.Kth Smallest Element in a Sorted Matrix
130.Heapify
4.Ugly Number II
401.Kth Smallest Number in Sorted Matrix
465.Kth Smallest Sum In Two Sorted Arrays (H)
471.Top K Frequent Words
486.Merge K Sorted Arrays
543.Kth Largest in N Arrays
544.Top k Largest Numbers
545.Top k Largest Numbers II
577.Merge K Sorted Interval Lists
612.K Closest Points
613.High Five
81.Find Median from Data Stream
360.Sliding Window Median

109.Triangle
110.Minimum Path Sum
114.Unique Paths
115.Unique Paths II
679.Unique Paths III

191.Maximum Product Subarray

Backpack

0-1 ่ƒŒๅŒ…้—ฎ้ข˜

Backpack
Backpack II
Backpack V
Backpack VI - 564.Combination Sum IV (M)

ๅคš้‡่ƒŒๅŒ…้—ฎ้ข˜

Backpack VII
Backpack VIII

ๅฎŒๅ…จ่ƒŒๅŒ…้—ฎ้ข˜

Backpack III
Backpack IV

433.Number of Islands
178.Graph Valid Tree
431.Connected Component in Undirected Graph (M)
589.Connecting Graph (M)
1070.Accounts Merge
589.Connecting Graph
590.Connecting Graph II
591.Connecting Graph III
434.Number of Islands II
805.Maximum Association Set
1396.Set Union
1569.Social Network

442.Implement Trie (Prefix Tree)
1090.Map Sum Pairs
559.Trie Service
132.Word Search II
634.Word Squares

391.Number of Airplanes in the Sky
919.Meeting Rooms II
821.Time Intersection

82.Single Number
83.Single Number II
84.Single Number III
824.Single Number IV

8.Rotate String
53.Reverse Words in a String
927.Reverse Words in a String II
1173.Reverse Words in a String III
1041.Reorganize String
78.Longest Common Prefix
784.The Longest Common Prefix II

80.Median
5.Kth Largest Element
894.Pancake Sorting

730.Sum of All Subsets

842.Origami
1022.Valid Tic-Tac-Toe State

Resources

Below are some good resources to look through:

ยฉ Copyright Zhenye Na May 2018

About

๐Ÿ‘จโ€๐Ÿ’ป This repository contains the solutions and explanations to the algorithm problems on LintCode. All are written in Python/Java/C++ and implemented by myself.

Topics

Resources

License

Stars

Watchers

Forks