Question: Two questions 1) how do I do this, 2) what is wrong with my code? Given a none-empty array, return a new array but with
Two questions 1) how do I do this, 2) what is wrong with my code? Given a none-empty array, return a new array but with the first and last elements repeated. padEnds([3, 4, 5]) [3, 3, 4, 5, 5] pad Ends([2, 7]) [2, 2, 7, 7] pad Ends([8]) [8, 8, 8] Go Save, Compile, Run int[] pad Ends (int[] nums) int[] newArray new int[nums -length 2] if(nums. length
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
