🔢 Arrays & Strings Problems

Master array manipulation, two pointers, sliding window, and string algorithms

Two Sum - Find pair that adds to target

Easy

Given an array of integers and a target, return indices of two numbers that add up to target.
Input: nums = [2,7,11,15], target = 9 → Output: [0,1]

java

3Sum - Find triplets that sum to zero

Medium

Find all unique triplets that sum to zero.
Input: [-1,0,1,2,-1,-4] → Output: [[-1,-1,2],[-1,0,1]]

java

Longest Substring Without Repeating Characters

Medium

Find the length of the longest substring without repeating characters.
Input: "abcabcbb" → Output: 3 ("abc")

java

Container With Most Water - Two Pointers

Medium

Find two lines that together with the x-axis form a container with most water.

java

Maximum Subarray - Kadane's Algorithm

Medium

Find the contiguous subarray with the largest sum.
Input: [-2,1,-3,4,-1,2,1,-5,4] → Output: 6 ([4,-1,2,1])

java

Merge Intervals - Combine overlapping intervals

Medium

Merge all overlapping intervals.
Input: [[1,3],[2,6],[8,10],[15,18]] → Output: [[1,6],[8,10],[15,18]]

java

Product of Array Except Self

Medium

Return an array where each element is the product of all elements except itself. No division allowed.
Input: [1,2,3,4] → Output: [24,12,8,6]

java

Trapping Rain Water

Hard

Given elevation map, compute how much water it can trap after raining.
Input: [0,1,0,2,1,0,1,3,2,1,2,1] → Output: 6

java

Minimum Window Substring

Hard

Find the minimum window in s which contains all characters of t.
Input: s = "ADOBECODEBANC", t = "ABC" → Output: "BANC"

java

Arrays & Strings Patterns