about | help | code help+videos | done | prefs |
moveMisbehavingStudent2
The order of "students" in a line is represented by an array of Strings. Position 0 represents the student at the beginning of the line. The student at "pos" is misbehaving, and needs to be moved to the end of the line. Every other student behind the misbehaving student should be moved one closer to the front. If the misbehaving student is the last student in line, then that student should be removed from the line by setting the value at "pos" to be null. The "students" array will always have at least one value, and "pos" will be a valid position in "students". moveMisbehavingStudent2(["Bob", "Moe", "Curly"], 0) → ["Moe", "Curly", "Bob"] moveMisbehavingStudent2(["Bob", "Moe", "Curly"], 1) → ["Bob", "Curly", "Moe"] moveMisbehavingStudent2(["Bob", "Moe", "Curly"], 2) → ["Bob", "Moe", null] ...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: 250 Post-solution available
Copyright Nick Parlante 2017 - privacy