Two Pointers | LeetCode Problems

117 Two Pointers solutions to LeetCode solutions.

Two Pointers Problems View all solutions →

Longest Palindromic Substring

#5 Medium

Container With Most Water

#11 Medium

3Sum

#15 Medium

3Sum Closest

#16 Medium

4Sum

#18 Medium

Remove Nth Node From End of List

#19 Medium

Remove Duplicates from Sorted Array

#26 Easy

Remove Element

#27 Easy

Implement strStr()

#28 Easy

Next Permutation

#31 Medium

Trapping Rain Water

#42 Hard

Rotate List

#61 Medium

Sort Colors

#75 Medium

Remove Duplicates from Sorted Array II

#80 Medium

Remove Duplicates from Sorted List II

#82 Medium

Partition List

#86 Medium

Merge Sorted Array

#88 Easy

Valid Palindrome

#125 Easy

Linked List Cycle

#141 Easy

Linked List Cycle II

#142 Medium

Reorder List

#143 Medium

Sort List

#148 Medium

Reverse Words in a String

#151 Medium

Intersection of Two Linked Lists

#160 Medium

Compare Version Numbers

#165 Medium

Two Sum II - Input Array Is Sorted

#167 Easy

Rotate Array

#189 Medium

Happy Number

#202 Easy

Palindrome Linked List

#234 Easy

Move Zeroes

#283 Easy

Find the Duplicate Number

#287 Medium

Find Median from Data Stream

#295 Hard

Create Maximum Number

#321 Hard

Reverse String

#344 Easy

Reverse Vowels of a String

#345 Easy

Intersection of Two Arrays

#349 Easy

Intersection of Two Arrays II

#350 Easy

Is Subsequence

#392 Easy

String Compression

#443 Medium

Assign Cookies

#455 Easy

Circular Array Loop

#457 Medium

Heaters

#475 Medium

Magical String

#481 Medium

Longest Uncommon Subsequence II

#522 Medium

Longest Word in Dictionary through Deleting

#524 Medium

K-diff Pairs in an Array

#532 Medium

Reverse String II

#541 Easy

Next Greater Element III

#556 Medium

Reverse Words in a String III

#557 Easy

Permutation in String

#567 Medium

Shortest Unsorted Continuous Subarray

#581 Medium

Valid Triangle Number

#611 Medium

Sum of Square Numbers

#633 Medium

Palindromic Substrings

#647 Medium

Two Sum IV - Input is a BST

#653 Easy

Find K Closest Elements

#658 Medium

Valid Palindrome II

#680 Easy

Count Binary Substrings

#696 Easy

Find K-th Smallest Pair Distance

#719 Hard

Partition Labels

#763 Medium

Swap Adjacent in LR String

#777 Medium

K-th Smallest Prime Fraction

#786 Medium

Number of Subarrays with Bounded Maximum

#795 Medium

Expressive Words

#809 Medium

Shortest Distance to a Character

#821 Easy

Friends Of Appropriate Ages

#825 Medium

Most Profit Assigning Work

#826 Medium

Flipping an Image

#832 Easy

Push Dominoes

#838 Medium

Backspace String Compare

#844 Easy

Longest Mountain in Array

#845 Medium

Advantage Shuffle

#870 Medium

Middle of the Linked List

#876 Easy

Boats to Save People

#881 Medium

Sort Array By Parity

#905 Easy

Reverse Only Letters

#917 Easy

Sort Array By Parity II

#922 Easy

3Sum With Multiplicity

#923 Medium

Long Pressed Name

#925 Easy

DI String Match

#942 Easy

Bag of Tokens

#948 Medium

Maximum Width Ramp

#962 Medium

Pancake Sorting

#969 Medium

Squares of a Sorted Array

#977 Easy

Interval List Intersections

#986 Medium

Camelcase Matching

#1023 Medium

Moving Stones Until Consecutive II

#1040 Medium

Longest String Chain

#1048 Medium

Duplicate Zeros

#1089 Easy

Longest Chunked Palindrome Decomposition

#1147 Hard

Last Substring in Lexicographical Order

#1163 Hard

Find Positive Integer Solution for a Given Equation

#1237 Medium

Remove Palindromic Subsequences

#1332 Easy

Check If N and Its Double Exist

#1346 Easy

Find the Distance Value Between Two Arrays

#1385 Easy

Check If a Word Occurs As a Prefix of Any Word in a Sentence

#1455 Easy

The k Strongest Values in an Array

#1471 Medium

Number of Subsequences That Satisfy the Given Sum Condition

#1498 Medium

Range Sum of Sorted Subarray Sums

#1508 Medium

Get the Maximum Score

#1537 Hard

Shortest Subarray to be Removed to Make Array Sorted

#1574 Medium

Number of Ways Where Square of Number Is Equal to Product of Two Numbers

#1577 Medium

Split Two Strings to Make Palindrome

#1616 Medium

Max Number of K-Sum Pairs

#1679 Medium

Form Array by Concatenating Subarrays of Another Array

#1764 Medium

Merge Strings Alternately

#1768 Easy

Reverse Prefix of Word

#2000 Easy

Delete the Middle Node of a Linked List

#2095 Medium

Maximum Twin Sum of a Linked List

#2130 Medium

Partition Array According to Given Pivot

#2161 Medium

Successful Pairs of Spells and Potions

#2300 Medium

Strictly Palindromic Number

#2396 Medium

Apply Operations to an Array

#2460 Easy

Total Cost to Hire K Workers

#2462 Medium

Maximum Number of Points From Grid Queries

#2503 Hard

Count the Number of Fair Pairs

#2563 Medium

Merge Two 2D Arrays by Summing Values

#2570 Easy