about | help | code help+videos | done | prefs |
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 have its place in line switched with the student after it in line. 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". moveMisbehavingStudent(["Bob", "Moe", "Curly"], 0) → ["Moe", "Bob", "Curly"] moveMisbehavingStudent(["Bob", "Moe", "Curly"], 1) → ["Bob", "Curly", "Moe"] moveMisbehavingStudent(["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: 150 Post-solution available
Copyright Nick Parlante 2017 - privacy