Check if Array is Sorted
Determine if an array is sorted in ascending, descending, or not sorted at all
Convert Sorted Array to Binary Search Tree
Convert a sorted array to a height-balanced binary search tree.
Daily Temperatures
Find the number of days until a warmer temperature for each day.
Design Circular Queue
Design a circular queue with fixed size that supports enqueue, dequeue, front, rear, isEmpty, and isFull operations.
Find Duplicate Number
Find the duplicate number in an array containing n+1 integers where each integer is between 1 and n (inclusive)
Find the Maximum Element in an Array
Find and return the largest element in an array of integers
Find the Second Largest Element in an Array
Find and return the second largest element in an array of integers
Implement Queue
Implement a queue using arrays or linked lists with O(1) time complexity for all operations.
Implement Stack
Design and implement a stack data structure with push, pop, top, and empty operations
Maximize Sum After K Negations
Maximize array sum by flipping signs of k elements using greedy heap approach
Merge Two Sorted Arrays
Merge two sorted arrays into a single sorted array in-place
Missing Number
Find the missing number in an array containing n distinct numbers taken from 0, 1, 2, ..., n.
Move All Zeros to the End
Move all zeros in an array to the end while maintaining the relative order of non-zero elements
Next Greater Element
Find the next greater element for each element in an array.
Reduce Array Size to Half
Find minimum removals to reduce array size by half using greedy heap approach
Reverse an Array
Reverse the order of elements in an array in-place and return the modified array
Rotate Array by K Steps
Rotate an array to the right by k steps where k is non-negative
Sliding Window Maximum
Find the maximum element in each sliding window of size k
Stock Span Problem
Calculate the span of stock prices for each day
Subarray with Given Sum
Find a subarray with a given sum in an array of positive integers.
Trapping Rain Water
Calculate how much rainwater can be trapped between bars of different heights
Two Sum
Find two numbers in an array that add up to a target value.