Skip to main content

55 docs tagged with "Two Pointers"

View all tags

3Sum losest (LeetCode)

Given an integer array nums of length n and an integer target, find three integers in nums such that the sum is closest to target.

4Sum (LeetCode)

Given an array nums of n integers, return an array of all the unique quadruplets [nums[a], nums[b], nums[c], nums[d]]

Assign Cookies

This is a solution to the Assign Cookies problem on LeetCode.

Container With Most Water (LeetCode)

Given n non-negative integers representing the heights of vertical lines, find the two lines that together with the x-axis form a container, such that the container contains the most water.

Find the Duplicate Number

Given an array of N + 1 size, where each element is between 1 and N. Assuming there is only one duplicate number, your task is to find the duplicate number.

Find Triplet with Zero Sum

This document explores different approaches to solving the problem of finding a triplet in an array that sums up to zero, including solutions in JavaScript, TypeScript, Python, Java, and C++.

Happy Number

This document provides a solution for Happy Number problem on LeetCode.

Heaters

This is a solution to the heaters problem on LeetCode.

Move Zeroes

This is a solution to the move zeroes in leetcode

Move Zeroes(LeetCode)

Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements.

Reorder List

This is a solution to the Reorder List problem on LeetCode.

Trapping Rain Water(LeetCode)

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.