about | help | code help+videos | done | prefs |
apcsaArraysSwapLeastWithFirst
This function returns the input array (or a copy of the input array) where the first element has been swapped with the least element. If the first element is the least element, the array is returned unchanged. If there are multiple elements tied for the "least value" crown, swap with the tied element that has the lowest index. HINT: this algorithm combines two prior algorithms from this problem set.apcsaArraysSwapLeastWithFirst([0, 1, 2, 3]) → [0, 1, 2, 3] apcsaArraysSwapLeastWithFirst([-1, -3, 5]) → [-3, -1, 5] apcsaArraysSwapLeastWithFirst([0]) → [0] ...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: 240
Copyright Nick Parlante 2017 - privacy