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
EasyFind two numbers in an array that add up to a target sum
Hash MapArray Traversal
Open Best Time to Buy and Sell Stock
EasyFind maximum profit from stock price array
Dynamic ProgrammingGreedy
Open Maximum Subarray
Coming soonFind contiguous subarray with largest sum
Kadane's AlgorithmDynamic Programming
Product of Array Except Self
Coming soonCalculate products without using division
Prefix SumArray Manipulation
Container With Most Water
Coming soonFind two lines that form maximum area container
Two PointersGreedy
Merge Intervals
Coming soonMerge overlapping intervals in an array
SortingIntervals