Array
Less than 1 minute
About Array
When memory is allocated for an array, its individual elements are adjacent, so we can access it by index.
let nums = [10, 11, 12, 13, 14, 15];
Array: 10 11 12 13 14 15
index: 0 1 2 3 4 5
assert_eq(nums[0], 10);
assert_eq(nums[5], 15);
assert_eq(nums[6], xx); // ERROR,index out of bounds
Exercise
Binary Search
704: Binary Search
35: Search Insert Position
34: Find First and Last Position of Element in Sorted Array
69: Sqrt(x)
367: Valid Perfect Square
Remove Element
27: Remove Element
26: Remove Duplicates from Sorted Array
283: Move Zeroes
844: Backspace String Compare
Square of Ordered Arrays
977: Squares of a Sorted Array
Minimum Size Subarray Sum
209: Minimum Size Subarray Sum
904: Fruit Into Baskets
76: Minimum Window Substring
Spiral Matrix
54: Spiral Matrix
59: Spiral Matrix II