1. Introduction
  2. Basic Data Structures and Algorithms
  3. 1. Complexity Analysis
    1. 1.1. Analyze Recursive Functions
    2. 1.2. Additional Resources
    3. 1.3. Conclusions
  4. 2. Arrays, Strings and Hashing
    1. 2.1. Arrays
    2. 2.2. Strings
    3. 2.3. Hashing
      1. 2.3.1. Sets
      2. 2.3.2. Dictionaries
    4. 2.4. Common Techniques
      1. 2.4.1. Two Pointers
        1. 2.4.1.1. Sliding Window
          1. 2.4.1.1.1. Static Size
          2. 2.4.1.1.2. Dynamic Size
        2. 2.4.1.2. Binary Search
  5. 3. Linked Lists
    1. 3.1. Singly Linked Lists
    2. 3.2. Doubly Linked Lists
  6. 4. Stacks and Queues
    1. 4.1. Stacks in Python
    2. 4.2. Queues in Python
    3. 4.3. Monotonic Stacks and Queues
  7. 5. Trees
    1. 5.1. Traversal
      1. 5.1.1. DFS
      2. 5.1.2. BFS
    2. 5.2. Binary Search Tree (BST)
    3. 5.3. Trie (Prefix Tree)
  8. 6. Graphs
    1. 6.1. Traversal
      1. 6.1.1. DFS
      2. 6.1.2. BFS
    2. 6.2. Disjoint Sets (Union-Find)
      1. 6.2.1. Quick Find
      2. 6.2.2. Quick Union
        1. 6.2.2.1. Union by Rank
        2. 6.2.2.2. Path Compression
        3. 6.2.2.3. Union by Rank + Path Compression
    3. 6.3. Topological Sorting
    4. 6.4. Weighted Graphs
  9. Advanced topics
  10. 7. Intervals
  11. 8. Heaps
  12. 9. Backtracking
  13. 10. Dynamic Programming
  14. 11. Divide and Conquer
  15. Practical part
  16. 12. Python for Coding Interviews
  17. 13. Grind 75
    1. 13.1. Arrays, Strings and Hashing
      1. 13.1.1. Two Sum
      2. 13.1.2. Best Time to Buy and Sell Stock
      3. 13.1.3. Valid Palindrome
      4. 13.1.4. Valid Anagram
      5. 13.1.5. Binary Search
      6. 13.1.6. First Bad Version
      7. 13.1.7. Ransom Note
      8. 13.1.8. Longest Palindrome
      9. 13.1.9. Majority Element
      10. 13.1.10. Add Binary
      11. 13.1.11. Contains Duplicate
      12. 13.1.12. Insert Interval
      13. 13.1.13. Longest Substring Without Repeating Characters
      14. 13.1.14. Two Sum II - Input Array Is Sorted
      15. 13.1.15. 3Sum
      16. 13.1.16. Product of Array Except Self
      17. 13.1.17. Merge Intervals
      18. 13.1.18. Time Based Key-Value Store
      19. 13.1.19. Sort Colors
      20. 13.1.20. Container With Most Water
      21. 13.1.21. Spiral Matrix
      22. 13.1.22. Search in Rotated Sorted Array
      23. 13.1.23. Longest Palindromic Substring
      24. 13.1.24. Find All Anagrams in a String
      25. 13.1.25. Minimum Window Substring
      26. 13.1.26. Maximum Profit in Job Scheduling
    2. 13.2. Linked Lists
      1. 13.2.1. Merge Two Sorted Lists
      2. 13.2.2. Linked List Cycle
      3. 13.2.3. Reverse Linked List
      4. 13.2.4. Middle of the Linked List
      5. 13.2.5. LRU Cache
    3. 13.3. Stacks and Queues
      1. 13.3.1. Valid Parentheses
      2. 13.3.2. Implement Queue using Stacks
      3. 13.3.3. Evaluate Reverse Polish Notation
      4. 13.3.4. Min Stack
      5. 13.3.5. Trapping Rain Water
      6. 13.3.6. Basic Calculator
      7. 13.3.7. Largest Rectangle in Histogram
    4. 13.4. Trees
      1. 13.4.1. Invert Binary Tree
      2. 13.4.2. Maximum Depth of Binary Tree
      3. 13.4.3. Lowest Common Ancestor of a Binary Search Tree
      4. 13.4.4. Balanced Binary Tree
      5. 13.4.5. Diameter of Binary Tree
      6. 13.4.6. Binary Tree Level Order Traversal
      7. 13.4.7. Validate Binary Search Tree
      8. 13.4.8. Lowest Common Ancestor of a Binary Tree
      9. 13.4.9. Binary Tree Right Side View
      10. 13.4.10. Construct Binary Tree from Preorder and Inorder Traversal
      11. 13.4.11. Kth Smallest Element in a BST
      12. 13.4.12. Serialize and Deserialize Binary Tree
    5. 13.5. Trie
      1. 13.5.1. Implement Trie (Prefix Tree)
    6. 13.6. Graphs
      1. 13.6.1. Flood Fill
      2. 13.6.2. 01 Matrix
      3. 13.6.3. Clone Graph
      4. 13.6.4. Course Schedule
      5. 13.6.5. Number of Islands
      6. 13.6.6. Rotting Oranges
      7. 13.6.7. Accounts Merge
      8. 13.6.8. Word Search
      9. 13.6.9. Minimum Height Trees
      10. 13.6.10. Word Ladder
    7. 13.7. Backtracking
      1. 13.7.1. Combination Sum
      2. 13.7.2. Permutations
      3. 13.7.3. Subsets
      4. 13.7.4. Letter Combinations of a Phone Number
    8. 13.8. Dynamic Programming
      1. 13.8.1. Climbing Stairs
      2. 13.8.2. Maximum Subarray
      3. 13.8.3. Coin Change
      4. 13.8.4. Unique Paths
      5. 13.8.5. Partition Equal Subset Sum
      6. 13.8.6. Word Break
    9. 13.9. Heaps
      1. 13.9.1. K Closest Points to Origin
      2. 13.9.2. Task Scheduler
      3. 13.9.3. Find Median from Data Stream
      4. 13.9.4. Merge k Sorted Lists
  18. Contributors

algo-ds.com

Two Sum II - Input Array Is Sorted

Check the Two Pointers algorithm section.