Welcome to the Array module of the DSA course.
An Array is a linear data structure that collects elements of the same data type and stores them in contiguous memory locations. It is the most fundamental structure you’ll use.
Key Characteristics
- Random Access: Access any element in
O(1)time. - Fixed Size: Static arrays cannot grow after creation.
- Memory: Highly cache-friendly due to sequential memory layout.
Time Complexity Reference
| Operation | Complexity |
|---|---|
| Access | O(1) |
| Search (Unsorted) | O(n) |
| Insertion/Deletion | O(n) |
In this module, we tackle classic problems that teach:
- In-place Algorithms: Modifying data without extra space.
- Frequency Maps: Using HashMaps to solve O(N) problems.
- Two Pointers: The industry standard for searching and sorting arrays.
Module Chapters
Chapter 1
Remove Duplicates from Sorted Array
Remove duplicates from a sorted array in-place such that each unique element appears only once.
Start Learning →Chapter 2
Best Time to Buy and Sell Stock II
Find the maximum profit you can achieve by buying and selling stock multiple times.
Start Learning →Chapter 3
Chapter 4
Contains Duplicate
Check if any value appears at least twice in an array using a HashSet.
Start Learning →Chapter 5
Chapter 6
Intersection of Two Arrays II
Find the intersection of two arrays with duplicate handling using HashMap or Two Pointers.
Start Learning →Chapter 7
Chapter 8
Move Zeroes
Move all zeros to the end while maintaining relative order using the two-pointer technique.
Start Learning →