Two Pointers Practice Concept
Two Pointers Practice Concept
-Kanik Chawla
1. Running from Both Ends of an Array
This category involves having two pointers at the left and right ends of an array, then
moving them toward the center while processing something with them.
● 2 Sum Problem
○ Next Permutation
○ Next Greater Element III
○ Minimum Adjacent Swaps to Reach the Kth Smallest Number
● Reversing / Swapping
○ Valid Palindrome
○ Reverse String
○ Reverse Vowels of a String
○ Valid Palindrome II
○ Reverse Only Letters
○ Remove Element
○ Sort Colors
○ Flipping an Image
○ Squares of a Sorted Array
○ Sort Array by Parity
○ Sort Array by Parity II
○ Pancake Sorting
○ Reverse Prefix of Word
○ Reverse String II
○ Reverse Words in a String
○ Reverse Words in a String III
● Others
○ Bag of Tokens
○ DI String Match
○ Minimum Length of String After Deleting Similar Ends
○ Sentence Similarity III
○ Find K Closest Elements
○ Shortest Distance to a Character
○ String Compression
○ Last Substring in Lexicographical Order
● Remove Duplicate
○ Implement StrStr
○ Longest Word in Dictionary Through Deleting
○ Long Pressed Name
○ Longest Uncommon Subsequence II
○ Compare Version Numbers
○ Camelcase Matching
○ Expressive Words
● Median Finder
● Partition
○ Partition List
● Sorting
○ Sort List