← back

Two Pointers

204 questions · 0 seen

All Two Pointers problems

Problems

5 Longest Palindromic Substring
11 Container With Most Water
15 3Sum
16 3Sum Closest
18 4Sum
19 Remove Nth Node From End of List
26 Remove Duplicates from Sorted Array
27 Remove Element
28 Find the Index of the First Occurrence in a String
31 Next Permutation
42 Trapping Rain Water
61 Rotate List
75 Sort Colors
80 Remove Duplicates from Sorted Array II
82 Remove Duplicates from Sorted List II
86 Partition List
88 Merge Sorted Array
125 Valid Palindrome
141 Linked List Cycle
142 Linked List Cycle II
143 Reorder List
148 Sort List
151 Reverse Words in a String
160 Intersection of Two Linked Lists
165 Compare Version Numbers
167 Two Sum II - Input Array Is Sorted
189 Rotate Array
202 Happy Number
234 Palindrome Linked List
283 Move Zeroes
287 Find the Duplicate Number
295 Find Median from Data Stream
321 Create Maximum Number
344 Reverse String
345 Reverse Vowels of a String
349 Intersection of Two Arrays
350 Intersection of Two Arrays II
392 Is Subsequence
443 String Compression
455 Assign Cookies
457 Circular Array Loop
475 Heaters
481 Magical String
522 Longest Uncommon Subsequence II
524 Longest Word in Dictionary through Deleting
532 K-diff Pairs in an Array
541 Reverse String II
556 Next Greater Element III
557 Reverse Words in a String III
567 Permutation in String
581 Shortest Unsorted Continuous Subarray
611 Valid Triangle Number
633 Sum of Square Numbers
647 Palindromic Substrings
653 Two Sum IV - Input is a BST
658 Find K Closest Elements
680 Valid Palindrome II
696 Count Binary Substrings
719 Find K-th Smallest Pair Distance
763 Partition Labels
777 Swap Adjacent in LR String
786 K-th Smallest Prime Fraction
795 Number of Subarrays with Bounded Maximum
809 Expressive Words
821 Shortest Distance to a Character
825 Friends Of Appropriate Ages
826 Most Profit Assigning Work
832 Flipping an Image
838 Push Dominoes
844 Backspace String Compare
845 Longest Mountain in Array
870 Advantage Shuffle
876 Middle of the Linked List
881 Boats to Save People
905 Sort Array By Parity
917 Reverse Only Letters
922 Sort Array By Parity II
923 3Sum With Multiplicity
925 Long Pressed Name
942 DI String Match
948 Bag of Tokens
962 Maximum Width Ramp
969 Pancake Sorting
977 Squares of a Sorted Array
986 Interval List Intersections
1023 Camelcase Matching
1048 Longest String Chain
1089 Duplicate Zeros
1147 Longest Chunked Palindrome Decomposition
1163 Last Substring in Lexicographical Order
1237 Find Positive Integer Solution for a Given Equation
1332 Remove Palindromic Subsequences
1346 Check If N and Its Double Exist
1385 Find the Distance Value Between Two Arrays
1455 Check If a Word Occurs As a Prefix of Any Word in a Sentence
1471 The k Strongest Values in an Array
1498 Number of Subsequences That Satisfy the Given Sum Condition
1508 Range Sum of Sorted Subarray Sums
1537 Get the Maximum Score
1574 Shortest Subarray to be Removed to Make Array Sorted
1577 Number of Ways Where Square of Number Is Equal to Product of Two Numbers
1616 Split Two Strings to Make Palindrome
1679 Max Number of K-Sum Pairs
1697 Checking Existence of Edge Length Limited Paths
1712 Ways to Split Array Into Three Subarrays
1721 Swapping Nodes in a Linked List (PRO)
1750 Minimum Length of String After Deleting Similar Ends
1754 Largest Merge Of Two Strings
1755 Closest Subsequence Sum
1764 Form Array by Concatenating Subarrays of Another Array
1768 Merge Strings Alternately (PRO)
1782 Count Pairs Of Nodes
1793 Maximum Score of a Good Subarray
1813 Sentence Similarity III
1850 Minimum Adjacent Swaps to Reach the Kth Smallest Number
1855 Maximum Distance Between a Pair of Values
1861 Rotating the Box
1877 Minimize Maximum Pair Sum in Array
1898 Maximum Number of Removable Characters
1960 Maximum Product of the Length of Two Palindromic Substrings
1961 Check If String Is a Prefix of Array (PRO)
1963 Minimum Number of Swaps to Make the String Balanced (PRO)
2000 Reverse Prefix of Word (PRO)
2014 Longest Subsequence Repeated k Times
2035 Partition Array Into Two Arrays to Minimize Sum Difference
2071 Maximum Number of Tasks You Can Assign
2095 Delete the Middle Node of a Linked List
2105 Watering Plants II
2108 Find First Palindromic String in the Array
2109 Adding Spaces to a String
2110 Number of Smooth Descent Periods of a Stock
2122 Recover the Original Array
2130 Maximum Twin Sum of a Linked List
2149 Rearrange Array Elements by Sign
2161 Partition Array According to Given Pivot
2193 Minimum Number of Moves to Make Palindrome
2200 Find All K-Distant Indices in an Array
2234 Maximum Total Beauty of the Gardens
2300 Successful Pairs of Spells and Potions
2332 The Latest Time to Catch a Bus
2337 Move Pieces to Obtain a String
2367 Number of Arithmetic Triplets
2396 Strictly Palindromic Number
2406 Divide Intervals Into Minimum Number of Groups
2410 Maximum Matching of Players With Trainers
2441 Largest Positive Integer That Exists With Its Negative
2460 Apply Operations to an Array
2462 Total Cost to Hire K Workers
2465 Number of Distinct Averages
2472 Maximum Number of Non-overlapping Palindrome Substrings
2486 Append Characters to String to Make Subsequence
2491 Divide Players Into Teams of Equal Skill
2503 Maximum Number of Points From Grid Queries
2511 Maximum Enemy Forts That Can Be Captured
2540 Minimum Common Value
2562 Find the Array Concatenation Value
2563 Count the Number of Fair Pairs
2565 Subsequence With the Minimum Score
2570 Merge Two 2D Arrays by Summing Values
2576 Find the Maximum Number of Marked Indices
2592 Maximize Greatness of an Array
2697 Lexicographically Smallest Palindrome
2824 Count Pairs Whose Sum is Less than Target
2825 Make String a Subsequence Using Cyclic Increments
2856 Minimum Array Length After Pair Removals
2903 Find Indices With Index and Value Difference I
2905 Find Indices With Index and Value Difference II
2911 Minimum Changes to Make K Semi-palindromes
2938 Separate Black and White Balls
2970 Count the Number of Incremovable Subarrays I
2972 Count the Number of Incremovable Subarrays II
3006 Find Beautiful Indices in the Given Array I
3008 Find Beautiful Indices in the Given Array II
3132 Find the Integer Added to Array II
3186 Maximum Total Damage With Spell Casting
3194 Minimum Average of Smallest and Largest Elements
3218 Minimum Cost for Cutting Cake I
3239 Minimum Number of Flips to Make Binary Grid Palindromic I
3240 Minimum Number of Flips to Make Binary Grid Palindromic II
3302 Find the Lexicographically Smallest Valid Sequence
3316 Find Maximum Removals From Source String
3403 Find the Lexicographically Largest String From the Box I
3455 Shortest Matching Substring
3503 Longest Palindrome After Substring Concatenation I
3504 Longest Palindrome After Substring Concatenation II
3534 Path Existence Queries in a Graph II
3584 Maximum Product of First and Last Elements of a Subsequence
3633 Earliest Finish Time for Land and Water Rides I
3635 Earliest Finish Time for Land and Water Rides II
3643 Flip Square Submatrix Vertically
3645 Maximum Total from Optimal Activation Order
3649 Number of Perfect Pairs
3685 Subsequence Sum After Capping Elements
3722 Lexicographically Smallest String After Reverse
3734 Lexicographically Smallest Palindromic Permutation Greater Than Target
3750 Minimum Number of Flips to Reverse Binary String
3752 Lexicographically Smallest Negated Permutation that Sums to Target
3766 Minimum Operations to Make Binary Palindrome
3775 Reverse Words With Same Vowel Count
3794 Reverse String Prefix
3801 Minimum Cost to Merge Sorted Lists
3814 Maximum Capacity Within Budget
3823 Reverse Letters Then Special Characters in a String
3844 Longest Almost-Palindromic Substring