Arrays

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

Showing 21 of 21 questions
Easy: 11
Medium: 8
Hard: 2
Question Difficulty
Buy and Sell Stock (Maximum Profit)
Find the maximum profit from buying and selling stock with at most one transaction
Easy
Check if Array is Sorted
Determine if an array is sorted in ascending, descending, or not sorted at all
Easy
Find the Maximum Element in an Array
Find and return the largest element in an array of integers
Easy
Find Missing Number (1 to n)
Find the missing number in an array containing n distinct numbers taken from 1, 2, 3, ..., n+1
Easy
Intersection of Two Arrays
Find the intersection of two arrays and return the result as an array.
Easy
Find Majority Element (Boyer-Moore Algorithm)
Find the majority element that appears more than n/2 times using Boyer-Moore majority vote algorithm
Easy
Merge Two Sorted Arrays
Merge two sorted arrays into a single sorted array in-place
Easy
Move All Zeros to the End
Move all zeros in an array to the end while maintaining the relative order of non-zero elements
Easy
Reverse an Array
Reverse the order of elements in an array in-place and return the modified array
Easy
Find the Second Largest Element in an Array
Find and return the second largest element in an array of integers
Easy
Two Sum
Find two numbers in an array that add up to a target value.
Easy
Find Duplicate Number
Find the duplicate number in an array containing n+1 integers where each integer is between 1 and n (inclusive)
Medium
Longest Consecutive Sequence
Find the length of the longest consecutive elements sequence in an unsorted array.
Medium
Maximum Subarray Sum (Kadane's Algorithm)
Find the contiguous subarray with maximum sum using Kadane's algorithm
Medium
Minimum Swaps to Sort Array
Find the minimum number of swaps required to sort an array.
Medium
Product of Array Except Self
Return an array where each element is the product of all elements except the element at that index.
Medium
Rotate Array by K Steps
Rotate an array to the right by k steps where k is non-negative
Medium
Subarray with Given Sum
Find a subarray with a given sum in an array of positive integers.
Medium
Three Sum (Triplets that Sum to Zero)
Find all unique triplets in the array which gives the sum of zero
Medium
Sliding Window Maximum
Find the maximum element in each sliding window of size k
Hard
Trapping Rain Water
Calculate how much rainwater can be trapped between bars of different heights
Hard