Arrays

Sum of Mutated Array Closest to Target

LeetCode problem #1300

Arrays

Master array manipulation with fundamental problems covering searching, sorting, and advanced algorithms.

Buy and Sell Stock (Maximum Profit)

Find the maximum profit from buying and selling stock with at most one transaction

Candy

Distribute the minimum number of candies to children in a line such that each child gets at least one and children with higher ratings get more than their neighbors

Find Majority Element (Boyer-Moore Algorithm)

Find the majority element that appears more than n/2 times using Boyer-Moore majority vote algorithm

Find Missing Number (1 to n)

Find the missing number in an array containing n distinct numbers taken from 1, 2, 3, ..., n+1

Intersection of Two Arrays

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

Jump Game

Determine if you can reach the last index of an array where each element represents the maximum jump length from that position

Jump Game II

Given an array where each element represents the maximum jump length, find the minimum number of jumps to reach the last index

Longest Consecutive Sequence

Find the length of the longest consecutive elements sequence in an unsorted array.

Maximum Subarray Sum (Kadane's Algorithm)

Find the contiguous subarray with maximum sum using Kadane's algorithm

Minimum Swaps to Sort Array

Find the minimum number of swaps required to sort an array.

Product of Array Except Self

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

Three Sum (Triplets that Sum to Zero)

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