Two Pointers
FundamentalsOpposite or parallel pointers traversing sequences in linear time O(N)
219 problems·61 Easy·129 Medium·29 Hard
Pattern Study Guide & Cheat Sheet▼
Search pairs or reverse sequences by moving two indices inward or in parallel, pruning suboptimal options in O(1) time without nested loops.
Core Invariant: Maintain the search space invariant: elements outside [left, right] have already been evaluated and eliminated. Advance whichever pointer monotonically improves or resolves the target condition.
Recognize it (Keywords & Signals)
- Array is sorted and you need to find a pair, triplet, or target sum
- Palindrome verification, string reversal, or inward symmetry checking
- Partitioning an array around a pivot (Dutch National Flag, sort colors)
- Trapping rainwater / container boundaries where width and height constrain area
When NOT to use
Array is unsorted and problem requires contiguous subarrays with sum K (especially with negative numbers; use Prefix Sum + Hash Map instead).
How to solve (Step-by-step)
- 1.Initialize left = 0 and right = len(nums) - 1 (for opposite-direction pointers).
- 2.In a `while left < right` loop, evaluate the current state: curr_sum = nums[left] + nums[right].
- 3.If target matched, record answer or return immediately.
- 4.If curr_sum < target, advance `left += 1` to increase sum; if curr_sum > target, decrement `right -= 1` to decrease sum.
- 5.Skip duplicate values using inner while loops when unique tuples are required (e.g. 3Sum).
Watch for (Interview Traps)
- Off-by-one in loop condition (`left < right` vs `left <= right` when element reuse is prohibited)
- Forgetting to skip duplicate elements inside the loop when unique triplets/quadruplets are needed
- Not advancing pointers inside duplicate skip loops causing infinite loops
Opposite-Direction Two Pointers
def two_pointers_search(nums: list[int], target: int) -> list[int]:
# Prerequisite: array must be sorted
left, right = 0, len(nums) - 1
while left < right:
curr_sum = nums[left] + nums[right]
if curr_sum == target:
return [left, right]
elif curr_sum < target:
left += 1 # Need larger sum -> move left inward
else:
right -= 1 # Need smaller sum -> move right inward
return []- Cost
- O(n) [or O(n log n) if sorting is required] · O(1) auxiliary memory (Sort in-place to preserve O(1) space guarantee.)
Canonical problems
#167 Two Sum II - Input Array Is Sorted: Inward movement directly targets sum
#15 3Sum: Fix one element, then run Two Pointers on sorted remainder
#11 Container With Most Water: Always move the shorter line inward
#125 Valid Palindrome: Compare characters inward while skipping non-alphanumerics
⌘K
Hard·47 companies·Max freq 100%·Acc 54.7%
TinderCohesityStackAdapt+44
Medium·44 companies·Max freq 100%·Acc 60.3%
GoDaddyRemoteStateLG Electronics+41
Easy·27 companies·Max freq 100%·Acc 0.6%
Wissen TechnologyImpetusUdemy+24
Medium·24 companies·Max freq 90%·Acc 64.6%
NianticNeetCode 150NeetCode 150+21
Medium·21 companies·Max freq 100%·Acc 52.0%
BroadcomSymantecNeetCode 150+18
Easy·18 companies·Max freq 100%·Acc 46.9%
Pocket GemsLG Electronicstcs+15
Medium·18 companies·Max freq 97%·Acc 65.4%
NeetCode 150NeetCode 150Amazon+15
Medium·18 companies·Max freq 95%·Acc 49.2%
NeetCode 150NeetCode 150Yandex+15
#143Reorder List
Medium·18 companies·Max freq 89%·Acc 65.7%
NeetCode 150NeetCode 150Arista Networks+15
Easy·13 companies·Max freq 75%·Acc 64.2%
AirbnbWells FargoSamsung+10
Medium·13 companies·Max freq 69%·Acc 78.0%
MicrostrategyServiceNowVisa+10
Medium·12 companies·Max freq 80%·Acc 89.9%
MetaNvidiaGeneral Motors+9
Medium·11 companies·Max freq 100%·Acc 52.1%
BlackBuckArista NetworksNvidia+8
Medium·11 companies·Max freq 89%·Acc 83.0%
MetaLinkedInMongoDB+8
Medium·10 companies·Max freq 100%·Acc 0.7%
Wissen TechnologyFreshWorksAccolite+7
Easy·9 companies·Max freq 100%·Acc 57.1%
McDonaldsNvidiaBloomberg+6
Hard·9 companies·Max freq 100%·Acc 23.9%
ArcesiumSamsungTexas Instruments+6
Medium·9 companies·Max freq 100%·Acc 38.4%
LiveRampeBayTikTok+6
Medium·9 companies·Max freq 100%·Acc 52.6%
McDonaldsQualcommSalesforce+6
Medium·9 companies·Max freq 97%·Acc 51.4%
razorpayTekionDE Shaw+6
Medium·7 companies·Max freq 88%·Acc 45.1%
CitadelPhonePeAmazon+4
Medium·7 companies·Max freq 88%·Acc 63.6%
AdobeWalmart LabsIBM+4
Medium·7 companies·Max freq 68%·Acc 49.7%
PayPayGoldman SachsAmazon+4
Medium·7 companies·Max freq 38%·Acc 60.9%
tcsGoogleGoldman Sachs+4
Hard·6 companies·Max freq 88%·Acc 35.1%
MathWorksQualcommIBM+3
Medium·6 companies·Max freq 76%·Acc 83.3%
Josh TechnologyAmazonGoogle+3
Easy·6 companies·Max freq 63%·Acc 87.8%
Josh TechnologyMetaAmazon+3
Medium·6 companies·Max freq 38%·Acc 49.1%
InfosysGoogleMeta+3
Medium·5 companies·Max freq 100%·Acc 41.1%
PalantirSamsaraBloomberg+2
Hard·5 companies·Max freq 88%·Acc 44.9%
SoFiLinkedInOracle+2
Hard·5 companies·Max freq 88%·Acc 50.0%
Walmart LabsAmazonMeta+2
Medium·5 companies·Max freq 88%·Acc 68.9%
AdobeAccoliteTikTok+2
Easy·5 companies·Max freq 75%·Acc 72.0%
ZeptoUberBloomberg+2
Easy·5 companies·Max freq 56%·Acc 74.6%
CoupangMicrosoftAmazon+2
Hard·5 companies·Max freq 50%·Acc 53.0%
RubrikIBMMicrosoft+2
Medium·5 companies·Max freq 38%·Acc 90.8%
AmazonBloombergMicrosoft+2
Medium·5 companies·Max freq 25%·Acc 40.9%
MicrosoftGoogleMeta+2
Medium·4 companies·Max freq 100%·Acc 0.5%
AlphonsoSnowflakeDE Shaw+1
Easy·4 companies·Max freq 100%·Acc 68.8%
YelpAmazonMicrosoft+1
Medium·4 companies·Max freq 100%·Acc 43.8%
MathWorksGSA CapitalBloomberg+1
Medium·4 companies·Max freq 88%·Acc 55.1%
AdobeUberAmazon+1
Easy·4 companies·Max freq 54%·Acc 81.5%
MathWorksPayPalMeta+1
Easy·4 companies·Max freq 25%·Acc 77.2%
GoogleBloombergAmazon+1
Medium·4 companies·Max freq 25%·Acc 75.4%
AmazonMetaGoogle+1
Medium·4 companies·Max freq 21%·Acc 0.6%
BloombergGoogleMeta+1
Easy·4 companies·Max freq 18%·Acc 72.9%
BloombergMicrosoftGoogle+1
Easy·4 companies·Max freq 16%·Acc 73.0%
AmazonBloombergMeta+1
Medium·3 companies·Max freq 100%·Acc 34.4%
RobinhoodTekionGoogle
Hard·3 companies·Max freq 100%·Acc 28.2%
PhonePePalantirGoogle
Hard·3 companies·Max freq 75%·Acc 40.5%
DE ShawIBMApple
Medium·3 companies·Max freq 50%·Acc 56.2%
Goldman SachsAmazonMeta
Medium·3 companies·Max freq 25%·Acc 67.7%
AmazonMicrosoftGoogle
Hard·3 companies·Max freq 25%·Acc 63.4%
UberGoogleMicrosoft
Medium·2 companies·Max freq 100%·Acc 31.7%
KLAAmazon
Easy·2 companies·Max freq 50%·Acc 56.8%
AppleMicrosoft
Medium·2 companies·Max freq 27%·Acc 33.5%
AmazonGoogle
Medium·2 companies·Max freq 25%·Acc 71.9%
GoogleMeta
Medium·2 companies·Max freq 25%·Acc 70.1%
TikTokGoogle
Medium·2 companies·Max freq 25%·Acc 73.1%
AmazonGoogle
Easy·2 companies·Max freq 25%·Acc 85.5%
AmazonGoogle
Medium·2 companies·Max freq 16%·Acc 64.3%
GoogleAmazon
Medium·2 companies·Max freq 13%·Acc 43.9%
MetaGoogle
Medium·2 companies·Max freq 13%·Acc 61.3%
MicrosoftGoogle
Medium·1 companies·Max freq 38%·Acc 31.4%
Amazon
Medium·1 companies·Max freq 38%·Acc 65.7%
Amazon
Medium·1 companies·Max freq 25%·Acc 55.0%
Amazon
Medium·1 companies·Max freq 18%·Acc 25.7%
Google
Medium·1 companies·Max freq 13%·Acc 53.2%
Google
Hard·1 companies·Max freq 13%·Acc 18.2%
Google
# | Problem | Difficulty | Top Companies↓ | Frequency | Acceptance | |
|---|---|---|---|---|---|---|
| #1 | Two Sum ArrayHash Table | Easy | 100% | 57.8% | ||
| #5 | Longest Palindromic Substring Two PointersStringDynamic ProgrammingManacher | Medium | 100% | 38.2% | ||
| #42 | Trapping Rain Water ArrayTwo PointersDynamic ProgrammingStackMonotonic Stack | Hard | 100% | 67.7% | ||
| #15 | 3Sum ArrayTwo PointersSorting | Medium | 100% | 39.4% | ||
| #11 | Container With Most Water ArrayTwo PointersGreedy | Medium | 100% | 60.4% | ||
| #295 | Find Median from Data Stream Two PointersDesignSortingHeap (Priority Queue)Data Stream | Hard | 100% | 54.7% | ||
| #253 | Meeting Rooms II ArrayTwo PointersGreedySortingHeap (Priority Queue)Prefix Sum | Medium | 100% | 52.7% | ||
| #283 | Move Zeroes ArrayTwo Pointers | Easy | 100% | 64.1% | ||
| #443 | String Compression Two PointersString | Medium | 100% | 60.3% | ||
| #125 | Valid Palindrome Two PointersString | Easy | 100% | 53.7% | ||
| #75 | Sort Colors ArrayTwo PointersSortingQuicksortBubble Sort | Medium | 100% | 70.0% | ||
| #88 | Merge Sorted Array ArrayTwo PointersSorting | Easy | 100% | 55.2% | ||
| #31 | Next Permutation ArrayTwo Pointers | Medium | 100% | 45.6% | ||
| #151 | Reverse Words in a String Two PointersString | Medium | 100% | 57.0% | ||
| #202 | Happy Number Hash TableMathTwo PointersFloyd's Cycle Finding Algorithm | Easy | 100% | 59.9% | ||
| #647 | Palindromic Substrings Two PointersStringDynamic Programming | Medium | 100% | 73.0% | ||
| #189 | Rotate Array ArrayMathTwo Pointers | Medium | 100% | 45.2% | ||
| #26 | Remove Duplicates from Sorted Array ArrayTwo Pointers | Easy | 100% | 0.6% | ||
| #141 | Linked List Cycle Hash TableLinked ListTwo PointersFloyd's Cycle Finding Algorithm | Easy | 100% | 54.7% | ||
| #287 | Find the Duplicate Number ArrayTwo PointersBinary SearchBit ManipulationPigeonhole PrincipleFloyd's Cycle Finding Algorithm | Medium | 90% | 64.6% | ||
| #19 | Remove Nth Node From End of List Linked ListTwo Pointers | Medium | 100% | 52.0% | ||
| #18 | Medium | 88% | 41.1% | |||
| #658 | Find K Closest Elements ArrayTwo PointersBinary SearchSliding WindowSortingHeap (Priority Queue) | Medium | 88% | 49.9% | ||
| #28 | Find the Index of the First Occurrence in a String Two PointersStringString MatchingZ AlgorithmKnuth–Morris–Pratt AlgorithmBoyer–Moore String-Search Algorithm | Easy | 100% | 46.9% | ||
| #167 | Medium | 97% | 65.4% | |||
| #567 | Permutation in String Hash TableTwo PointersStringSliding Window | Medium | 95% | 49.2% | ||
| #234 | Palindrome Linked List Linked ListTwo PointersStackRecursion | Easy | 91% | 58.3% | ||
| #143 | Reorder List Linked ListTwo PointersStackRecursion | Medium | 89% | 65.7% | ||
| #407 | Hard | 100% | 64.1% | |||
| #977 | Squares of a Sorted Array ArrayTwo PointersSorting | Easy | 92% | 73.9% | ||
| #680 | Valid Palindrome II Two PointersStringGreedy | Easy | 100% | 44.5% | ||
| #1048 | Longest String Chain ArrayHash TableTwo PointersStringDynamic ProgrammingSorting | Medium | 100% | 63.3% | ||
| #392 | Is Subsequence Two PointersStringDynamic Programming | Easy | 88% | 49.2% | ||
| #344 | Reverse String Two PointersString | Easy | 82% | 81.0% | ||
| #844 | Backspace String Compare Two PointersStringStackSimulation | Easy | 79% | 50.0% | ||
| #876 | Middle of the Linked List Linked ListTwo Pointers | Easy | 88% | 82.1% | ||
| #881 | Boats to Save People ArrayTwo PointersGreedySortingTimsort | Medium | 80% | 0.6% | ||
| #142 | Linked List Cycle II Hash TableLinked ListTwo PointersFloyd's Cycle Finding Algorithm | Medium | 77% | 58.5% | ||
| #160 | Intersection of Two Linked Lists Hash TableLinked ListTwo Pointers | Easy | 75% | 64.2% | ||
| #1963 | Minimum Number of Swaps to Make the String Balanced Two PointersStringStackGreedyBracket Sequences | Medium | 69% | 78.0% | ||
| #345 | Reverse Vowels of a String Two PointersString | Easy | 69% | 61.7% | ||
| #986 | Interval List Intersections ArrayTwo PointersSweep Line | Medium | 100% | 73.1% | ||
| #277 | Find the Celebrity Two PointersGraph TheoryInteractive | Medium | 100% | 49.0% | ||
| #16 | 3Sum Closest ArrayTwo PointersSorting | Medium | 100% | 48.9% | ||
| #1570 | Dot Product of Two Sparse Vectors ArrayHash TableTwo PointersDesignLinear Algebra | Medium | 80% | 89.9% | ||
| #475 | Heaters ArrayTwo PointersBinary SearchSorting | Medium | 78% | 42.2% | ||
| #82 | Remove Duplicates from Sorted List II Linked ListTwo Pointers | Medium | 100% | 52.1% | ||
| #723 | Candy Crush ArrayTwo PointersMatrixSimulation | Medium | 100% | 77.6% | ||
| #165 | Compare Version Numbers Two PointersString | Medium | 100% | 46.7% | ||
| #1229 | Meeting Scheduler ArrayTwo PointersSorting | Medium | 91% | 55.2% | ||
| #1650 | Lowest Common Ancestor of a Binary Tree III Hash TableTwo PointersTreeBinary TreeBinary LiftingLowest Common Ancestor | Medium | 89% | 83.0% | ||
| #1768 | Merge Strings Alternately Two PointersString | Easy | 75% | 82.1% | ||
| #763 | Partition Labels Hash TableTwo PointersStringGreedy | Medium | 67% | 82.0% | ||
| #556 | Next Greater Element III MathTwo PointersString | Medium | 65% | 35.4% | ||
| #27 | Remove Element ArrayTwo Pointers | Easy | 63% | 62.1% | ||
| #1861 | Rotating the Box ArrayTwo PointersMatrix | Medium | 100% | 82.5% | ||
| #80 | Remove Duplicates from Sorted Array II ArrayTwo Pointers | Medium | 100% | 0.7% | ||
| #161 | One Edit Distance Two PointersString | Medium | 100% | 34.6% | ||
| #845 | Longest Mountain in Array ArrayTwo PointersDynamic ProgrammingEnumeration | Medium | 100% | 42.3% | ||
| #611 | Valid Triangle Number ArrayTwo PointersBinary SearchGreedySorting | Medium | 100% | 57.0% | ||
| #83 | Remove Duplicates from Sorted List Linked List | Easy | 100% | 57.1% | ||
| #2035 | Partition Array Into Two Arrays to Minimize Sum Difference ArrayTwo PointersBinary SearchDynamic ProgrammingBit ManipulationMeet in the MiddleSortingOrdered SetBitmask | Hard | 100% | 23.9% | ||
| #581 | Shortest Unsorted Continuous Subarray ArrayTwo PointersStackGreedySortingMonotonic Stack | Medium | 100% | 38.4% | ||
| #2563 | Count the Number of Fair Pairs ArrayTwo PointersBinary SearchSorting | Medium | 100% | 52.6% | ||
| #1574 | Shortest Subarray to be Removed to Make Array Sorted ArrayTwo PointersBinary SearchStackMonotonic Stack | Medium | 97% | 51.4% | ||
| #962 | Maximum Width Ramp ArrayTwo PointersStackMonotonic Stack | Medium | 88% | 55.9% | ||
| #350 | Intersection of Two Arrays II ArrayHash TableTwo PointersBinary SearchSorting | Easy | 88% | 60.1% | ||
| #455 | Assign Cookies ArrayTwo PointersGreedySortingQuicksort | Easy | 63% | 55.3% | ||
| #61 | Rotate List Linked ListTwo Pointers | Medium | 63% | 42.9% | ||
| #148 | Sort List Linked ListTwo PointersDivide and ConquerSortingMerge Sort | Medium | 51% | 64.8% | ||
| #653 | Two Sum IV - Input is a BST Hash TableTwo PointersTreeDepth-First SearchBreadth-First SearchBinary Search TreeBinary Tree | Easy | 88% | 63.5% | ||
| #905 | Sort Array By Parity ArrayTwo PointersSorting | Easy | 75% | 76.6% | ||
| #321 | Create Maximum Number ArrayTwo PointersStackGreedyMonotonic Stack | Hard | 64% | 0.4% | ||
| #532 | K-diff Pairs in an Array ArrayHash TableTwo PointersBinary SearchSorting | Medium | 54% | 46.1% | ||
| #408 | Valid Word Abbreviation Two PointersString | Easy | 100% | 37.0% | ||
| #557 | Reverse Words in a String III Two PointersString | Easy | 100% | 84.1% | ||
| #2592 | Maximize Greatness of an Array ArrayTwo PointersGreedySorting | Medium | 100% | 61.9% | ||
| #3186 | Maximum Total Damage With Spell Casting ArrayHash TableTwo PointersBinary SearchDynamic ProgrammingSortingCounting | Medium | 88% | 45.1% | ||
| #2406 | Divide Intervals Into Minimum Number of Groups ArrayTwo PointersGreedySortingHeap (Priority Queue)Prefix Sum | Medium | 88% | 63.6% | ||
| #1679 | Max Number of K-Sum Pairs ArrayHash TableTwo PointersSorting | Medium | 75% | 57.2% | ||
| #2300 | Successful Pairs of Spells and Potions ArrayTwo PointersBinary SearchSorting | Medium | 68% | 49.7% | ||
| #259 | 3Sum Smaller ArrayTwo PointersBinary SearchSorting | Medium | 63% | 51.4% | ||
| #925 | Long Pressed Name Two PointersString | Easy | 39% | 33.0% | ||
| #541 | Reverse String II Two PointersString | Easy | 39% | 54.1% | ||
| #2095 | Delete the Middle Node of a Linked List Linked ListTwo Pointers | Medium | 38% | 60.9% | ||
| #1877 | Minimize Maximum Pair Sum in Array ArrayTwo PointersGreedySorting | Medium | 89% | 83.3% | ||
| #1163 | Last Substring in Lexicographical Order Two PointersStringLyndon Factorization | Hard | 88% | 35.1% | ||
| #3649 | Number of Perfect Pairs ArrayMathTwo PointersSorting | Medium | 88% | 34.4% | ||
| #2130 | Maximum Twin Sum of a Linked List Linked ListTwo PointersStack | Medium | 76% | 83.3% | ||
| #838 | Push Dominoes Two PointersStringDynamic Programming | Medium | 64% | 63.0% | ||
| #2824 | Count Pairs Whose Sum is Less than Target ArrayTwo PointersBinary SearchSorting | Easy | 63% | 87.8% | ||
| #922 | Sort Array By Parity II ArrayTwo PointersSorting | Easy | 63% | 71.3% | ||
| #633 | Sum of Square Numbers MathTwo PointersBinary Search | Medium | 50% | 36.9% | ||
| #2149 | Rearrange Array Elements by Sign ArrayTwo PointersSimulation | Medium | 50% | 84.7% | ||
| #832 | Flipping an Image ArrayTwo PointersBit ManipulationMatrixSimulation | Easy | 42% | 83.9% | ||
| #1498 | Number of Subsequences That Satisfy the Given Sum Condition ArrayTwo PointersBinary SearchSorting | Medium | 38% | 49.1% | ||
| #1721 | Swapping Nodes in a Linked List Linked ListTwo Pointers | Medium | 38% | 69.6% | ||
| #2570 | Merge Two 2D Arrays by Summing Values ArrayHash TableTwo Pointers | Easy | 35% | 81.7% | ||
| #826 | Most Profit Assigning Work ArrayTwo PointersBinary SearchGreedySorting | Medium | 100% | 56.3% | ||
| #2000 | Reverse Prefix of Word Two PointersStringStack | Easy | 100% | 86.5% | ||
| #3006 | Find Beautiful Indices in the Given Array I Two PointersStringBinary SearchRolling HashString MatchingHash FunctionZ AlgorithmKnuth–Morris–Pratt AlgorithmBoyer–Moore String-Search Algorithm | Medium | 100% | 41.1% | ||
| #2472 | Maximum Number of Non-overlapping Palindrome Substrings Two PointersStringDynamic ProgrammingGreedy | Hard | 88% | 44.9% | ||
| #2071 | Maximum Number of Tasks You Can Assign ArrayTwo PointersBinary SearchGreedyQueueSortingMonotonic Queue | Hard | 88% | 50.0% | ||
| #2422 | Merge Operations to Turn Array Into a Palindrome ArrayTwo PointersGreedy | Medium | 88% | 68.9% | ||
| #917 | Reverse Only Letters Two PointersString | Easy | 81% | 68.7% | ||
| #1385 | Find the Distance Value Between Two Arrays ArrayTwo PointersBinary SearchSorting | Easy | 75% | 72.0% | ||
| #2441 | Largest Positive Integer That Exists With Its Negative ArrayHash TableTwo PointersSorting | Easy | 56% | 74.6% | ||
| #2193 | Minimum Number of Moves to Make Palindrome Two PointersStringGreedyBinary Indexed Tree | Hard | 50% | 53.0% | ||
| #2337 | Move Pieces to Obtain a String Two PointersString | Medium | 43% | 56.6% | ||
| #3356 | Zero Array Transformation II ArrayTwo PointersBinary SearchPrefix Sum | Medium | 39% | 43.6% | ||
| #86 | Partition List Linked ListTwo Pointers | Medium | 38% | 61.5% | ||
| #2161 | Partition Array According to Given Pivot ArrayTwo PointersSimulation | Medium | 38% | 90.8% | ||
| #1346 | Check If N and Its Double Exist ArrayHash TableTwo PointersBinary SearchSorting | Easy | 30% | 41.9% | ||
| #3362 | Zero Array Transformation III ArrayTwo PointersGreedySortingHeap (Priority Queue)Prefix Sum | Medium | 28% | 54.7% | ||
| #3403 | Find the Lexicographically Largest String From the Box I Two PointersStringEnumeration | Medium | 25% | 40.9% | ||
| #2109 | Adding Spaces to a String ArrayTwo PointersStringSimulation | Medium | 25% | 71.9% | ||
| #719 | Find K-th Smallest Pair Distance ArrayTwo PointersBinary SearchSorting | Hard | 25% | 46.7% | ||
| #2460 | Apply Operations to an Array ArrayTwo PointersSimulation | Easy | 18% | 74.7% | ||
| #1898 | Maximum Number of Removable Characters ArrayTwo PointersStringBinary Search | Medium | 100% | 0.5% | ||
| #923 | 3Sum With Multiplicity ArrayHash TableTwo PointersSortingCounting | Medium | 100% | 46.4% | ||
| #1455 | Check If a Word Occurs As a Prefix of Any Word in a Sentence Two PointersStringString Matching | Easy | 100% | 68.8% | ||
| #2462 | Total Cost to Hire K Workers ArrayTwo PointersHeap (Priority Queue)Simulation | Medium | 100% | 43.8% | ||
| #244 | Shortest Word Distance II ArrayHash TableTwo PointersStringDesign | Medium | 88% | 62.9% | ||
| #795 | Number of Subarrays with Bounded Maximum ArrayTwo Pointers | Medium | 88% | 55.1% | ||
| #186 | Reverse Words in a String II Two PointersString | Medium | 65% | 56.8% | ||
| #948 | Bag of Tokens ArrayTwo PointersGreedySorting | Medium | 63% | 59.7% | ||
| #2697 | Lexicographically Smallest Palindrome Two PointersStringGreedy | Easy | 54% | 81.5% | ||
| #1813 | Sentence Similarity III ArrayTwo PointersString | Medium | 39% | 48.4% | ||
| #457 | Circular Array Loop ArrayHash TableTwo PointersFloyd's Cycle Finding Algorithm | Medium | 38% | 37.8% | ||
| #3867 | Sum of GCD of Formed Pairs ArrayMathTwo PointersSortingSimulationNumber Theory | Medium | 29% | 65.9% | ||
| #1089 | Duplicate Zeros ArrayTwo Pointers | Easy | 29% | 53.8% | ||
| #2200 | Find All K-Distant Indices in an Array ArrayTwo Pointers | Easy | 25% | 77.2% | ||
| #2410 | Maximum Matching of Players With Trainers ArrayTwo PointersGreedySorting | Medium | 25% | 75.4% | ||
| #3302 | Find the Lexicographically Smallest Valid Sequence Two PointersStringDynamic ProgrammingGreedy | Medium | 21% | 0.6% | ||
| #821 | Shortest Distance to a Character ArrayTwo PointersString | Easy | 18% | 72.9% | ||
| #3633 | Earliest Finish Time for Land and Water Rides I ArrayTwo PointersBinary SearchGreedySorting | Easy | 16% | 73.0% | ||
| #3534 | Path Existence Queries in a Graph II ArrayTwo PointersBinary SearchDynamic ProgrammingGreedyBit ManipulationGraph TheorySorting | Hard | 15% | 64.6% | ||
| #454 | 4Sum II ArrayHash Table | Medium | 13% | 58.1% | ||
| #969 | Pancake Sorting ArrayTwo PointersGreedySorting | Medium | 100% | 71.9% | ||
| #1712 | Ways to Split Array Into Three Subarrays ArrayTwo PointersBinary SearchPrefix Sum | Medium | 100% | 34.4% | ||
| #3008 | Find Beautiful Indices in the Given Array II Two PointersStringBinary SearchRolling HashString MatchingHash FunctionZ AlgorithmKnuth–Morris–Pratt AlgorithmBoyer–Moore String-Search Algorithm | Hard | 100% | 28.2% | ||
| #1755 | Closest Subsequence Sum ArrayTwo PointersDynamic ProgrammingBit ManipulationMeet in the MiddleSortingBitmask | Hard | 90% | 44.0% | ||
| #1055 | Shortest Way to Form String Two PointersStringBinary SearchGreedy | Medium | 88% | 61.7% | ||
| #870 | Advantage Shuffle ArrayTwo PointersGreedySorting | Medium | 75% | 54.8% | ||
| #2972 | Count the Number of Incremovable Subarrays II ArrayTwo PointersBinary Search | Hard | 75% | 40.5% | ||
| #360 | Sort Transformed Array ArrayMathTwo PointersSorting | Medium | 67% | 58.2% | ||
| #272 | Closest Binary Search Tree Value II Two PointersStackTreeDepth-First SearchBinary Search TreeHeap (Priority Queue)Binary Tree | Hard | 63% | 61.2% | ||
| #1216 | Valid Palindrome III StringDynamic Programming | Hard | 63% | 49.2% | ||
| #825 | Friends Of Appropriate Ages ArrayTwo PointersBinary SearchSorting | Medium | 51% | 49.9% | ||
| #1750 | Minimum Length of String After Deleting Similar Ends Two PointersString | Medium | 50% | 56.2% | ||
| #2332 | The Latest Time to Catch a Bus ArrayTwo PointersBinary SearchSorting | Medium | 38% | 30.1% | ||
| #2540 | Minimum Common Value ArrayHash TableTwo PointersBinary Search | Easy | 38% | 60.8% | ||
| #2110 | Number of Smooth Descent Periods of a Stock ArrayMathTwo PointersDynamic ProgrammingSliding Window | Medium | 25% | 67.7% | ||
| #2014 | Longest Subsequence Repeated k Times Hash TableTwo PointersStringBacktrackingCountingEnumeration | Hard | 25% | 71.1% | ||
| #942 | DI String Match ArrayTwo PointersStringGreedy | Easy | 25% | 81.2% | ||
| #481 | Magical String Two PointersString | Medium | 25% | 55.7% | ||
| #1697 | Checking Existence of Edge Length Limited Paths ArrayTwo PointersUnion-FindGraph TheorySorting | Hard | 25% | 63.4% | ||
| #3584 | Maximum Product of First and Last Elements of a Subsequence ArrayTwo Pointers | Medium | 100% | 31.7% | ||
| #1885 | Count Pairs in Two Arrays ArrayTwo PointersBinary SearchSorting | Medium | 100% | 60.3% | ||
| #524 | Longest Word in Dictionary through Deleting ArrayTwo PointersStringSorting | Medium | 89% | 52.8% | ||
| #1754 | Largest Merge Of Two Strings Two PointersStringGreedy | Medium | 88% | 0.5% | ||
| #1023 | Camelcase Matching ArrayTwo PointersStringTrieString Matching | Medium | 75% | 65.6% | ||
| #2562 | Find the Array Concatenation Value ArrayTwo PointersSimulation | Easy | 65% | 72.1% | ||
| #246 | Strobogrammatic Number Hash TableTwo PointersString | Easy | 51% | 47.5% | ||
| #2970 | Count the Number of Incremovable Subarrays I ArrayTwo PointersBinary SearchEnumeration | Easy | 50% | 56.8% | ||
| #170 | Two Sum III - Data structure design ArrayHash TableTwo PointersDesignData Stream | Easy | 50% | 39.2% | ||
| #1868 | Product of Two Run-Length Encoded Arrays ArrayTwo Pointers | Medium | 50% | 59.6% | ||
| #809 | Expressive Words ArrayTwo PointersString | Medium | 38% | 46.9% | ||
| #3316 | Find Maximum Removals From Source String ArrayHash TableTwo PointersStringDynamic Programming | Medium | 37% | 0.4% | ||
| #2396 | Strictly Palindromic Number MathTwo PointersBrainteaser | Medium | 28% | 90.4% | ||
| #3645 | Maximum Total from Optimal Activation Order ArrayTwo PointersGreedySortingHeap (Priority Queue) | Medium | 27% | 33.5% | ||
| #1850 | Minimum Adjacent Swaps to Reach the Kth Smallest Number Two PointersStringGreedy | Medium | 25% | 71.9% | ||
| #2330 | Medium | 25% | 75.6% | |||
| #1237 | Find Positive Integer Solution for a Given Equation MathTwo PointersBinary SearchInteractive | Medium | 25% | 70.1% | ||
| #1332 | Remove Palindromic Subsequences Two PointersString | Easy | 25% | 77.1% | ||
| #3814 | Maximum Capacity Within Budget ArrayTwo PointersBinary SearchSorting | Medium | 25% | 20.6% | ||
| #2465 | Number of Distinct Averages ArrayHash TableTwo PointersSorting | Easy | 25% | 59.1% | ||
| #2486 | Append Characters to String to Make Subsequence Two PointersStringGreedy | Medium | 25% | 73.1% | ||
| #3194 | Minimum Average of Smallest and Largest Elements ArrayTwo PointersSorting | Easy | 25% | 85.5% | ||
| #1793 | Maximum Score of a Good Subarray ArrayTwo PointersBinary SearchStackMonotonic StackCartesian Tree | Hard | 25% | 64.2% | ||
| #3635 | Earliest Finish Time for Land and Water Rides II ArrayTwo PointersBinary SearchGreedySorting | Medium | 16% | 64.3% | ||
| #3503 | Longest Palindrome After Substring Concatenation I Two PointersStringDynamic ProgrammingEnumeration | Medium | 13% | 43.9% | ||
| #3643 | Flip Square Submatrix Vertically ArrayTwo PointersMatrix | Easy | 13% | 79.4% | ||
| #1855 | Maximum Distance Between a Pair of Values ArrayTwo PointersBinary Search | Medium | 13% | 61.3% | ||
| #3132 | Find the Integer Added to Array II ArrayTwo PointersSortingEnumeration | Medium | 100% | 33.1% | ||
| #2903 | Find Indices With Index and Value Difference I ArrayTwo Pointers | Easy | 100% | 60.3% | ||
| #2905 | Find Indices With Index and Value Difference II ArrayTwo Pointers | Medium | 100% | 32.8% | ||
| #2838 | Maximum Coins Heroes Can Collect ArrayTwo PointersBinary SearchSortingPrefix Sum | Medium | 100% | 68.8% | ||
| #3766 | Minimum Operations to Make Binary Palindrome ArrayTwo PointersBinary SearchBit Manipulation | Medium | 100% | 52.2% | ||
| #2604 | Minimum Time to Eat All Grains ArrayTwo PointersBinary SearchSorting | Hard | 88% | 40.9% | ||
| #3667 | Sort Array By Absolute Value ArrayMathTwo PointersSorting | Easy | 80% | 86.7% | ||
| #2234 | Maximum Total Beauty of the Gardens ArrayTwo PointersBinary SearchGreedySortingEnumerationPrefix Sum | Hard | 75% | 30.2% | ||
| #2856 | Minimum Array Length After Pair Removals ArrayHash TableTwo PointersBinary SearchGreedyCounting | Medium | 75% | 27.8% | ||
| #2565 | Subsequence With the Minimum Score Two PointersStringBinary Search | Hard | 51% | 33.5% | ||
| #1961 | Check If String Is a Prefix of Array ArrayTwo PointersString | Easy | 50% | 53.0% | ||
| #3752 | Lexicographically Smallest Negated Permutation that Sums to Target ArrayMathTwo PointersGreedySorting | Medium | 38% | 31.4% | ||
| #2825 | Make String a Subsequence Using Cyclic Increments Two PointersString | Medium | 38% | 65.7% | ||
| #1826 | Faulty Sensor ArrayTwo Pointers | Easy | 25% | 50.5% | ||
| #1099 | Two Sum Less Than K ArrayTwo PointersBinary SearchSorting | Easy | 25% | 62.1% | ||
| #1214 | Two Sum BSTs Two PointersBinary SearchStackTreeDepth-First SearchBinary Search TreeBinary Tree | Medium | 25% | 68.2% | ||
| #1842 | Next Palindrome Using Same Digits Two PointersString | Hard | 25% | 54.3% | ||
| #3455 | Shortest Matching Substring Two PointersStringBinary SearchString Matching | Hard | 25% | 24.6% | ||
| #1764 | Form Array by Concatenating Subarrays of Another Array ArrayTwo PointersGreedyString MatchingKnuth–Morris–Pratt Algorithm | Medium | 25% | 55.0% | ||
| #1634 | Add Two Polynomials Represented as Linked Lists Linked ListMathTwo Pointers | Medium | 25% | 61.1% | ||
| #1782 | Count Pairs Of Nodes ArrayHash TableTwo PointersBinary SearchGraph TheorySortingCounting | Hard | 25% | 42.9% | ||
| #3730 | Maximum Calories Burnt from Jumps ArrayTwo PointersGreedySorting | Medium | 25% | 72.0% | ||
| #3794 | Reverse String Prefix Two PointersString | Easy | 25% | 89.5% | ||
| #522 | Longest Uncommon Subsequence II ArrayHash TableTwo PointersStringSorting | Medium | 25% | 45.2% | ||
| #1147 | Longest Chunked Palindrome Decomposition Two PointersStringDynamic ProgrammingGreedyRolling HashHash Function | Hard | 25% | 59.0% | ||
| #1616 | Split Two Strings to Make Palindrome Two PointersString | Medium | 25% | 32.5% | ||
| #1471 | The k Strongest Values in an Array ArrayTwo PointersSorting | Medium | 25% | 62.8% | ||
| #2105 | Watering Plants II ArrayTwo PointersSimulation | Medium | 25% | 48.9% | ||
| #2122 | Recover the Original Array ArrayHash TableTwo PointersSortingEnumeration | Hard | 25% | 41.8% | ||
| #3240 | Minimum Number of Flips to Make Binary Grid Palindromic II ArrayTwo PointersMatrix | Medium | 18% | 25.7% | ||
| #3685 | Subsequence Sum After Capping Elements ArrayTwo PointersDynamic ProgrammingSorting | Medium | 13% | 25.4% | ||
| #466 | Count The Repetitions Two PointersStringDynamic Programming | Hard | 13% | 35.1% | ||
| #3896 | Minimum Operations to Transform Array into Alternating Prime ArrayMathTwo PointersBinary SearchSortingNumber Theory | Medium | 13% | 53.2% | ||
| #3504 | Longest Palindrome After Substring Concatenation II Two PointersStringDynamic Programming | Hard | 13% | 18.2% | ||
| #3940 | Limit Occurrences in Sorted Array ArrayTwo Pointers | Easy | 5% | 0.7% |
Showing 219 of 219 problems in Two PointersFiltered: All Companies