about | help | code help+videos | done | prefs |
array_firstMiddleLast
array_firstMiddleLast -- Given an array determine if it has an even or odd number of elements. If it contains an even number of elements return an array containing the first and last elements. If it contains an odd number of elements return an array containing the first, middle, and last elements. If the array only has one or no elements just return the original array. array_firstMiddleLast([]) → [] array_firstMiddleLast([0]) → [0] array_firstMiddleLast([1, 2, 3, 4]) → [1, 4] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy