Intermediate Two Pointers Problems for Coding Interviews
27 intermediate Two Pointers problems from real coding interviews, each with test cases you can run online. By difficulty they split into 0 basic, 27 intermediate and 0 advanced. The companies that ask them most often are Amazon, Google, Meta, Microsoft.
Solve a few problems of each level, name the pattern after each one and revisit the ones that needed a hint a week later. Practise stating the time and space complexity and the edge cases before you code.
Coding problems
- Longest Palindromic Substring (Intermediate)
- Count Palindromic Substrings (Intermediate)
- Minimum Insertions to Make Palindrome (Intermediate)
- Longest Palindromic Subsequence (Intermediate)
- BST Successor and Predecessor (Intermediate)
- Pseudo-Palindromic Root-to-Leaf Paths (Intermediate)
- Swap Kth Nodes From Both Ends (Intermediate)
- Count Palindromic Partitions (Intermediate)
- Longest Palindrome by Concatenating Two-Letter Words (Intermediate)
- Rotate Image (Intermediate)
- Remove Duplicates Allowing Twice (Intermediate)
- Palindrome Partitioning List (Intermediate)
- Reverse Even-Valued Runs (Intermediate)
- Longest Palindromic Sublist (Intermediate)
- Flatten Binary Tree to Linked List (Intermediate)
- Unique Length-3 Palindromic Subsequences (Intermediate)
- Break a Palindrome (Intermediate)
- Construct K Palindrome Strings (Intermediate)
- Can Make Palindrome From Substring (Intermediate)
- Sort Transformed Array (Intermediate)
- Largest Palindromic Number (Intermediate)
- Minimum Characters to Append for Palindrome (Intermediate)
- Double-Base Palindromes Sum (Intermediate)
- Smallest Base Where Number Is Palindrome (Intermediate)
- Heap Build Swap Count (Intermediate)
- Largest Palindrome Product of Two N-Digit Numbers (Intermediate)
- Smallest Base Making a Palindrome (Intermediate)
Related
Frequently asked questions
How do I get good at two pointers problems?
Practise by level, name the pattern after you solve each problem and review the ones you needed hints for. The list is ordered so you can start with the basic ones.
Can I run two pointers problems online here?
Yes. Each problem opens in an editor that runs your code against test cases in Java, Python, C++, Go, JavaScript and more.