Top Coder
Top Coder
$9.99
Minimum price
$19.99
Suggested price
Top Coder

Last updated on 2015-04-28

About the Book

This book is not just questions and answers. It opens with a discussion of strategies to tackle each question and its similar questions, diving into exactly how to break down and solve it

About the Author

Monster Chan
Monster Chan

I work in SainStore Inc. I am familiar with aws. I am also a iOS developer. I hope i can share my experiences and enhance our capabilities.

Table of Contents

  • 1. Array
    • 1.1 Two Sum
    • 1.2 3Sum
    • 1.3 3Sum Closest
    • 1.4 4Sum
    • 1.5 Remove Element
    • 1.6 Next Permutation
    • 1.7 Permutation Sequence
    • 1.8 Valid Sudoku
    • 1.9 Trapping Rain Water
    • 1.10 Rotate Image
    • 1.11 Plus One
    • 1.12 Word Search
    • 1.13 Word Ladder II
    • 1.14 Remove Duplicates from Sorted Array
    • 1.15 Remove Duplicates from Sorted Array II
    • 1.16 Search in Rotated Sorted Array
    • 1.17 Search in Rotated Sorted Array II
    • 1.18 Median of Two Sorted Arrays
    • 1.19 Longest Consecutive Sequence
    • 1.20 Set Matrix Zeroes
    • 1.21 Merge Sorted Array
    • 1.22 Merge Intervals
    • 1.23 Rotate Array
    • 1.24 Unique Paths
    • 1.25 Unique Paths II
    • 1.26 Triangle
    • 1.27 Subsets
    • 1.28 Subsets II
    • 1.29 Spiral Matrix
    • 1.30 Spiral Matrix II
    • 1.31 Sort Colors
    • 1.32 Pascal’s Triangle
    • 1.33 Pascal’s Triangle II
    • 1.34 Search Insert Position
    • 1.35 Search for a Range
    • 1.36 Search a 2D Matrix
    • 1.37 Minimum Path Sum
    • 1.38 Maximum Subarray
    • 1.39 Maximum Product Subarray
    • 1.40 Maximal Rectangle
    • 1.41 Majority Element
    • 1.42 Largest Rectangle in Histogram
    • 1.43 Jump Game
    • 1.44 Jump Game II
    • 1.45 Insert Interval
    • 1.46 First Missing Positive
    • 1.47 Find Peak Element
    • 1.48 Find Minimum in Rotated Sorted Array
    • 1.49 Find Minimum in Rotated Sorted Array II
    • 1.50 Container With Most Water
    • 1.51 Construct Binary Tree from Preorder and Inorder Traversal
    • 1.52 Construct Binary Tree from Inorder and Postorder Traversal
    • 1.53 Combination Sum
    • 1.54 Combination Sum II
    • 1.55 Best Time to Buy and Sell Stock
    • 1.56 Best Time to Buy and Sell Stock II
    • 1.57 Best Time to Buy and Sell Stock III
  • 2. Hash Table
    • 2.1 Valid Sudoku
    • 2.2 Two Sum
    • 2.3 Sudoku Solver
    • 2.4 Substring with Concatenation of All Words
    • 2.5 Single Number
    • 2.6 Repeated DNA Sequences
    • 2.7 Max Points on a Line
    • 2.8 Longest Substring Without Repeating Characters
    • 2.9 Fraction to Recurring Decimal
    • 2.10 Copy List with Random Pointer
    • 2.11 Binary Tree Inorder Traversal
    • 2.12 Anagrams
    • 2.13 Minimum Window Substring
  • 3. Linked List
    • 3.1 Swap Nodes in Pairs
    • 3.2 Sort List
    • 3.3 Rotate List
    • 3.4 Reverse Nodes in k-Group
    • 3.5 Reverse Linked List II
    • 3.6 Reorder List
    • 3.7 Remove Nth Node From End of List
    • 3.8 Remove Duplicates from Sorted List
    • 3.9 Remove Duplicates from Sorted List II
    • 3.10 Partition List
    • 3.11 Merge Two Sorted Lists
    • 3.12 Merge k Sorted Lists
    • 3.13 Linked List Cycle
    • 3.14 Linked List Cycle II
    • 3.15 Intersection of Two Linked Lists
    • 3.16 Insertion Sort List
    • 3.17 Convert Sorted List to Binary Search Tree
    • 3.18 Add Two Numbers
  • 4. Math
    • 4.1 Valid Number
    • 4.2 String to Integer (atoi)
    • 4.3 Sqrt(x)
    • 4.4 Roman to Integer
    • 4.5 Reverse Integer
    • 4.6 Pow(x, n)
    • 4.7 Plus One
    • 4.8 Permutation Sequence
    • 4.9 Palindrome Number
    • 4.10 Multiply Strings
    • 4.11 Max Points on a Line
    • 4.12 Integer to Roman
    • 4.13 Fraction to Recurring Decimal
    • 4.14 Factorial Trailing Zeroes
    • 4.15 Excel Sheet Column Title
    • 4.16 Excel Sheet Column Number
    • 4.17 Divide Two Integers
    • 4.18 Add Two Numbers
    • 4.19 Add Binary
  • 5. Two Pointers
    • 5.1 Valid Palindrome
    • 5.2 Trapping Rain Water
    • 5.3 Substring with Concatenation of All Words
    • 5.4 Sort Colors
    • 5.5 Rotate List
    • 5.6 Remove Nth Node From End of List
    • 5.7 Remove Element
    • 5.8 Remove Duplicates from Sorted Array
    • 5.9 Remove Duplicates from Sorted Array II
    • 5.10 Partition List
    • 5.11 Minimum Window Substring
    • 5.12 Merge Sorted Array
    • 5.13 Longest Substring Without Repeating Characters
    • 5.14 Linked List Cycle
    • 5.15 Linked List Cycle II
    • 5.16 Implement strStr()
    • 5.17 Container With Most Water
    • 5.18 4Sum
    • 5.19 3Sum
    • 5.20 3Sum Closest
  • 6. String
    • 6.1 ZigZag Conversion
    • 6.2 Word Ladder II
    • 6.3 Wildcard Matching
    • 6.4 Valid Parentheses
    • 6.5 Valid Palindrome
    • 6.6 Valid Number
    • 6.7 Text Justification
    • 6.8 Substring with Concatenation of All Words
    • 6.9 String to Integer (atoi)
    • 6.10 Simplify Path
    • 6.11 Scramble String
    • 6.12 Roman to Integer
    • 6.13 Reverse Words in a String
    • 6.14 Restore IP Addresses
    • 6.15 Regular Expression Matching
    • 6.16 Multiply Strings
    • 6.17 Minimum Window Substring
    • 6.18 Longest Valid Parentheses
    • 6.19 Longest Substring Without Repeating Characters
    • 6.20 Longest Palindromic Substring
    • 6.21 Longest Common Prefix
    • 6.22 Letter Combinations of a Phone Number
    • 6.23 Length of Last Word
    • 6.24 Interleaving String
    • 6.25 Integer to Roman
    • 6.26 Implement strStr()
    • 6.27 Generate Parentheses
    • 6.28 Edit Distance
    • 6.29 Distinct Subsequences
    • 6.30 Decode Ways
    • 6.31 Count and Say
    • 6.32 Compare Version Numbers
    • 6.33 Anagrams
    • 6.34 Add Binary
  • 7. Binary Search
    • 7.1 Sqrt(x)
    • 7.2 Search Insert Position
    • 7.3 Search in Rotated Sorted Array
    • 7.4 Search in Rotated Sorted Array II
    • 7.5 Search for a Range
    • 7.6 Search a 2D Matrix
    • 7.7 Pow(x, n)
    • 7.8 Median of Two Sorted Arrays
    • 7.9 Find Peak Element
    • 7.10 Find Minimum in Rotated Sorted Array
    • 7.11 Find Minimum in Rotated Sorted Array II
    • 7.12 Dungeon Game
    • 7.13 Divide Two Integers
  • 8. Divide and Conquer
    • 8.1 Merge k Sorted Lists
    • 8.2 Median of Two Sorted Arrays
    • 8.3 Maximum Subarray
    • 8.4 Majority Element
  • 9. Dynamic Programming
    • 9.1 Word Break
    • 9.2 Word Break II
    • 9.3 Wildcard Matching
    • 9.4 Unique Paths
    • 9.5 Unique Paths II
    • 9.6 Unique Binary Search Trees
    • 9.7 Unique Binary Search Trees II
    • 9.8 Triangle
    • 9.9 Scramble String
    • 9.10 Regular Expression Matching
    • 9.11 Palindrome Partitioning II
    • 9.12 Minimum Path Sum
    • 9.13 Maximum Subarray
    • 9.14 Maximum Product Subarray
    • 9.15 Maximal Rectangle
    • 9.16 Longest Valid Parentheses
    • 9.17 Interleaving String
    • 9.18 House Robber
    • 9.19 Edit Distance
    • 9.20 Dungeon Game
    • 9.21 Distinct Subsequences
    • 9.22 Decode Ways
    • 9.23 Climbing Stairs
    • 9.24 Best Time to Buy and Sell Stock
    • 9.25 Best Time to Buy and Sell Stock IV
    • 9.26 Best Time to Buy and Sell Stock III
  • 10. Backtracking
    • 10.1 Word Search
    • 10.2 Word Ladder II
    • 10.3 Word Break II
    • 10.4 Wildcard Matching
    • 10.5 Sudoku Solver
    • 10.6 Subsets
    • 10.7 Subsets II
    • 10.8 Restore IP Addresses
    • 10.9 Regular Expression Matching
    • 10.10 Permutations
    • 10.11 Permutations II
    • 10.12 Permutation Sequence
    • 10.13 Palindrome Partitioning
    • 10.14 N-Queens
    • 10.15 N-Queens II
    • 10.16 Letter Combinations of a Phone Number
    • 10.17 Gray Code
    • 10.18 Generate Parentheses
    • 10.19 Combinations
    • 10.20 Combination Sum
    • 10.21 Combination Sum II
  • 11. Stack
    • 11.1 Valid Parentheses
    • 11.2 Trapping Rain Water
    • 11.3 Simplify Path
    • 11.4 Min Stack
    • 11.5 Maximal Rectangle
    • 11.6 Largest Rectangle in Histogram
    • 11.7 Evaluate Reverse Polish Notation
    • 11.8 Binary Tree Zigzag Level Order Traversal
    • 11.9 Binary Tree Preorder Traversal
    • 11.10 Binary Tree Postorder Traversal
    • 11.11 Binary Tree Inorder Traversal
    • 11.12 Binary Search Tree Iterator
  • 12. Heap
    • 12.1 Merge k Sorted Lists
  • 13. Greedy
    • 13.1 Wildcard Matching
    • 13.2 Jump Game
    • 13.3 Jump Game II
    • 13.4 Gas Station
    • 13.5 Candy
    • 13.6 Best Time to Buy and Sell Stock II
  • 14. Sort
    • 14.1 Sort List
    • 14.2 Sort Colors
    • 14.3 Merge Intervals
    • 14.4 Maximum Gap
    • 14.5 Largest Number
    • 14.6 Insertion Sort List
    • 14.7 Insert Interval
  • 15. Bit Manipulation
    • 15.1 Subsets
    • 15.2 Single Number
    • 15.3 Single Number II
    • 15.4 Reverse Bits
    • 15.5 Repeated DNA Sequences
    • 15.6 Number of 1 Bits
    • 15.7 Majority Element
    • 15.8 Bitwise AND of Numbers Range
  • 16. Tree
    • 16.1 Validate Binary Search Tree
    • 16.2 Unique Binary Search Trees
    • 16.3 Unique Binary Search Trees II
    • 16.4 Symmetric Tree
    • 16.5 Sum Root to Leaf Numbers
    • 16.6 Same Tree
    • 16.7 Recover Binary Search Tree
    • 16.8 Populating Next Right Pointers in Each Node
    • 16.9 Populating Next Right Pointers in Each Node II
    • 16.10 Path Sum
    • 16.11 Path Sum II
    • 16.12 Minimum Depth of Binary Tree
    • 16.13 Maximum Depth of Binary Tree
    • 16.14 Flatten Binary Tree to Linked List
    • 16.15 Convert Sorted Array to Binary Search Tree
    • 16.16 Construct Binary Tree from Preorder and Inorder Traversal
    • 16.17 Construct Binary Tree from Inorder and Postorder Traversal
    • 16.18 Binary Tree Zigzag Level Order Traversal
    • 16.19 Binary Tree Right Side View
    • 16.20 Binary Tree Preorder Traversal
    • 16.21 Binary Tree Postorder Traversal
    • 16.22 Binary Tree Maximum Path Sum
    • 16.23 Binary Tree Level Order Traversal
    • 16.24 Binary Tree Level Order Traversal II
    • 16.25 Binary Tree Inorder Traversal
    • 16.26 Binary Search Tree Iterator
    • 16.27 Balanced Binary Tree
  • 17. Depth-first Search
    • 17.1 Validate Binary Search Tree
    • 17.2 Symmetric Tree
    • 17.3 Sum Root to Leaf Numbers
    • 17.4 Same Tree
    • 17.5 Recover Binary Search Tree
    • 17.6 Populating Next Right Pointers in Each Node
    • 17.7 Populating Next Right Pointers in Each Node II
    • 17.8 Path Sum
    • 17.9 Path Sum II
    • 17.10 Number of Islands
    • 17.11 Minimum Depth of Binary Tree
    • 17.12 Maximum Depth of Binary Tree
    • 17.13 Flatten Binary Tree to Linked List
    • 17.14 Convert Sorted List to Binary Search Tree
    • 17.15 Convert Sorted Array to Binary Search Tree
    • 17.16 Construct Binary Tree from Preorder and Inorder Traversal
    • 17.17 Construct Binary Tree from Inorder and Postorder Traversal
    • 17.18 Clone Graph
    • 17.19 Binary Tree Right Side View
    • 17.20 Binary Tree Maximum Path Sum
    • 17.21 Balanced Binary Tree
  • 18. Breadth-first Search
    • 18.1 Word Ladder
    • 18.2 Word Ladder II
    • 18.3 Surrounded Regions
    • 18.4 Number of Islands
    • 18.5 Clone Graph
    • 18.6 Binary Tree Zigzag Level Order Traversal
    • 18.7 Binary Tree Right Side View
    • 18.8 Binary Tree Level Order Traversal
    • 18.9 Binary Tree Level Order Traversal II
  • 19. Graph
    • 19.1 Clone Graph
  • 20. Data Structure
    • 20.1 Min Stack
    • 20.2 LRU Cache

Authors have earned$8,253,833writing, publishing and selling on Leanpub,
earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. Free App. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets), MOBI (for Kindle) and in the free Leanpub App (for Mac, Windows, iOS and Android). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub