# Two Pointers

## Trapping Rain Water LeetCode Solution

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.

## Next Permutation LeetCode Solution

Given an array of integers nums, find the next permutation of nums.

## Find the Index of the First Occurrence in a String LeetCode Solution

Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

## Remove Element LeetCode Solution

Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The relative order of the elements may be changed.

## 3Sum LeetCode Solution

Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.

## Longest Substring Without Repeating Characters LeetCode Solution

Given a string s, find the length of the longest substring without repeating characters.

## Remove Duplicates from Sorted Array LeetCode Solution

Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same.

Scroll to Top