Fundamentals/Constant vs Linear Time
← PrevNext →
Implement getFirst(arr) which returns the first element in O(1) time, and getLast(arr) which returns the last element in O(1) time. Return [first, last].