about | help | code help+videos | done | prefs |
minMax
Return both the smallest and the largest elements ({min, max}) in a non-empty array of integers. We'll use the convention of considering only part of the array that begins at a given index and ends at another. In this way, a recursive call can work through any part of the array. The initial call will pass in index 0 and the index to the last element. The return value should be a two-element array containing the smallest first and the largest second. minMax([2, 1, -2, 3, 8], 0, 4) → [-2, 8] minMax([6, 2, -4], 0, 2) → [-4, 6] minMax([5], 0, 0) → [5, 5] ...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: 300
Copyright Nick Parlante 2017 - privacy