Two-Pointers

Add Two Numbers

Add two numbers represented as linked lists where digits are stored in reverse order

Celebrity Problem

Find the celebrity in a party of n people using the minimum number of questions.

Check if String is Palindrome

Determine if a string reads the same forwards and backwards, ignoring case and non-alphanumeric characters.

Circular Linked List Detection

Detect if a linked list has a cycle and find the starting point of the cycle

Detect Cycle in Linked List

Detect if a linked list has a cycle using Floyd's cycle detection algorithm

Find Duplicate Number

Find the duplicate number in an array containing n+1 integers where each integer is between 1 and n (inclusive)

Find Middle of Linked List

Find the middle node of a linked list using the two-pointer technique

Implement strStr (Find Substring)

Find the first occurrence of a substring in a string, similar to strstr() function.

Intersection of Two Arrays

Find the intersection of two arrays and return the result as an array.

Intersection of Two Linked Lists

Find the intersection node of two linked lists

Longest Palindromic Substring

Find the longest palindromic substring in a given string

Longest Substring Without Repeating Characters

Find the length of the longest substring without repeating characters

Merge Two Sorted Arrays

Merge two sorted arrays into a single sorted array in-place

Merge Two Sorted Lists

Merge two sorted linked lists into one sorted linked list

Minimum Window Substring

Find the minimum window substring that contains all characters of another string

Move All Zeros to the End

Move all zeros in an array to the end while maintaining the relative order of non-zero elements

Palindrome Linked List

Check if a linked list is a palindrome using O(1) extra space

Partition List

Partition a linked list around a value x such that all nodes less than x come before nodes greater than or equal to x

Product of Array Except Self

Return an array where each element is the product of all elements except the element at that index.

Remove Duplicates from Sorted List

Remove all duplicate values from a sorted linked list

Remove Nth Node From End of List

Remove the nth node from the end of a linked list in one pass

Reorder List

Reorder a linked list by interleaving nodes from the beginning and end

Reverse a Linked List

Reverse a singly linked list in-place

Reverse an Array

Reverse the order of elements in an array in-place and return the modified array

Reverse String

Reverse a string in-place using O(1) extra memory.

Rotate Linked List

Rotate a linked list to the right by k places

Smallest Substring with All Characters

Find the smallest substring that contains all characters of a given pattern

String Compression

Compress a string by replacing consecutive characters with character and count.

Subarray with Given Sum

Find a subarray with a given sum in an array of positive integers.

Three Sum (Triplets that Sum to Zero)

Find all unique triplets in the array which gives the sum of zero

Trapping Rain Water

Calculate how much rainwater can be trapped between bars of different heights

Two Sum

Find two numbers in an array that add up to a target value.