Arrays

Arrays are fundamental data structures that store elements in contiguous memory locations. They provide constant-time access to elements using indices and are the foundation for many other data structures and algorithms.

Key points

  • Random access in O(1) time using indices
  • Fixed or dynamic size depending on implementation
  • Cache-friendly due to contiguous memory
  • Foundation for sorting and searching algorithms
  • Efficient iteration and bulk operations

Problems

Two Sum

Easy

Find two numbers in an array that add up to a target sum

Hash MapArray Traversal
Open

Best Time to Buy and Sell Stock

Easy

Find maximum profit from stock price array

Dynamic ProgrammingGreedy
Open

Maximum Subarray

Coming soon

Find contiguous subarray with largest sum

Kadane's AlgorithmDynamic Programming

Product of Array Except Self

Coming soon

Calculate products without using division

Prefix SumArray Manipulation

Container With Most Water

Coming soon

Find two lines that form maximum area container

Two PointersGreedy

Merge Intervals

Coming soon

Merge overlapping intervals in an array

SortingIntervals