about | help | code help+videos | done | prefs |
Write a method that has an integer array input parameter 'nums', which will have at least one element. Return 'nums' but with the first and last numbers in the array swapped. For example, if 'nums' is {1,2,3,4,5,6,7} you would return {7,2,3,4,5,6,1}. Look at the test data for more examples. Preconditions: 'nums' will be a non-empty array of integers. test2024_10_31_APP1SLHL_swapFirstAndLast([4, 5]) → [5, 4] test2024_10_31_APP1SLHL_swapFirstAndLast([7]) → [7] test2024_10_31_APP1SLHL_swapFirstAndLast([800, 400, 100, 5]) → [5, 400, 100, 800] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 230
Copyright Nick Parlante 2017 - privacy