This is lintcode solution in Java with eplaination and generalization.
# | Title | Solution | Difficulty | Source Code |
---|---|---|---|---|
35 | Reverse Linked List | Easy | ReverseLinkedList.java | |
104 | Merge K Sorted Lists | divide and merge 2 lists | Medium | MergeKSortedLists.java |
105 | Copy List with Random Pointer | map + recursive | Medium | CopyListwithRandomPointer.java |
134 | LRU Cache | HashMap + linkedlist | Hard | LRUCache.java |
165 | Merge Two Sorted Lists | easy loop | Easy | MergeTwoSortedLists.java |
Tree
# | Title | Solution | Difficulty | Source Code |
---|---|---|---|---|
# | Title | Solution | Difficulty | Source Code |
---|---|---|---|---|
15 | Permutations | backtrace | Medium | Permutations.java |
17 | Subsets | backtrace | Medium | Subsets.java |
56 | Two Sum | hashmap | Easy | TwoSum.java |
57 | 3Sum | two point | Medium | ThreeSum.java |
58 | 4Sum | two point | Medium | FourSum.java |
135 | Combination Sum | backtrace | Medium | CombinationSum.java |
153 | Combination Sum II | backtrace | Medium | CombinationSumII.java |
389 | Valid Sudoku | Easy | ValidSudoku.java | |
564 | Combination Sum IV | dp or recursive | Medium | CombinationSumIV.java |
787 | The Maze | bfs | Medium | TheMaze.java |
788 | The Maze II | dfs or bfs | Medium | TheMazeII.java |
802 | Sudoku Solver | backtracking | Hard | SudokuSolver.java |
919 | Meeting Rooms II | heap or treemap | Medium | MeetingRoomsII.java |
957 | Radar Detection | Easy | RadarDetection.java | |
959 | K Spaced Array Sorting | Medium | KSpacedArraySorting.java | |
1301 | Game of Life | Medium | GameofLife.java |
# | Title | Solution | Difficulty | Source Code |
---|---|---|---|---|
29 | Interleaving String | dp | Medium | InterleavingString.java |
76 | Longest Increasing Subsequence | dp | Medium | LongestIncreasingSubsequence.java |
77 | Longest Common Subsequence | dp | Medium | LongestCommonSubsequence.java |
107 | Word Break | dp | Medium | WordBreak.java |
108 | Palindrome Partitioning II | dp | Medium | PalindromePartitioningII.java |
109 | Triangle | dp | Medium | Triangle.java |
110 | Minimum Path Sum | dp | Easy | MinimumPathSum.java |
111 | Climbing Stairs | dp | Easy | ClimbingStairs.java |
114 | Unique Paths | dp | Easy | UniquePaths.java |
115 | Unique Paths II | dp | Easy | UniquePathsII.java |
116 | Jump Game | dp | Medium | JumpGame.java |
117 | Jump Game II | dp | Medium | JumpGameII.java |
118 | Distinct Subsequences | dp | Medium | DistinctSubsequences.java |
119 | Edit Distance | dp | Medium | EditDistance.java |
163 | Unique Binary Search Trees | dp | Medium | UniqueBinarySearchTrees.java |
168 | Burst Balloons | dp | Hard | BurstBalloons.java |
392 | House Robber | dp | Medium | HouseRobber.java |
622 | Frog Jump | dp or dfs | Hard | FrogJump.java |
# | Title | Solution | Difficulty | Source Code |
---|---|---|---|---|
12 | Min Stack | linkedlist | Medium | MinStack.java |
528 | Flatten Nested List Iterator | stack | Medium | FlattenNestedListIterator.java |
# | Title | Solution | Difficulty | Source Code |
---|---|---|---|---|
69 | Binary Tree Level Order Traversal | bfs | Easy | BinaryTreeLevelOrderTraversal.java |
70 | Binary Tree Level Order Traversal II | bfs | Medium | BinaryTreeLevelOrderTraversalII.java |
95 | Validate Binary Search Tree | recursive | Medium | ValidateBinarySearchTree.java |
651 | Binary Tree Vertical Order Traversal | bfs + hashmap | Medium | BinaryTreeVerticalOrderTraversal.java |
900 | Closest Binary Search Tree Value | dfs | Medium | ClosestBinarySearchTreeValue.java |
# | Title | Solution | Difficulty | Source Code |
---|---|---|---|---|
204 | Singleton | ood | Naive | Singleton.java |
456 | Reference | ood | Naive | ReferenceManager.java |
560 | Friendship Service | ood | Easy | FriendshipService.java |
566 | GFS Client | ood | Medium | GFSClient.java |
708 | ElevatorSystem | ood | Hard | ElevatorSystem.java |
748 | Kindle OO Design | ood | Medium | KindleOODesign.java |