Loading Array Length and Ends
Array Length and Ends
Easy · Arrays and Matrix · 1. Array boundaries
Practice Array Length and Ends in the browser. Write your solution, run tests, and review the walkthrough after your attempt.
Write a function that returns a three-element array with the length, first value, and last value of a non-empty integer array nums, without a loop through the array.
Constraints
1 <= nums.length <= 10^5-10^9 <= nums[i] <= 10^9