about | help | code help+videos | done | prefs |
move68
move68 Given an integer array as input, return a new array of equal length with a new ordering of 6's and 8's. Whenever a 6 is encountered swap the next 8 into the position immediatly following the 6. the 6 will always occur first and there are equal numbers of 6's and 8's. move68([1, 6, 1, 8]) → [1, 6, 8, 1] move68([1, 6, 1, 8, 8, 6, 1]) → [1, 6, 8, 1, 1, 6, 8] move68([6, 2, 2, 8]) → [6, 8, 2, 2] ...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