id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

addNewStudent


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. A new student, "newStud", needs to be placed in the line at the null spot closest to the front. If there are no null spots, then "newStud" is not added to "students"


addNewStudent(["Bob", "Moe", "Curly"], "Shemp") → ["Bob", "Moe", "Curly"]
addNewStudent(["Bob", "Moe", null], "Shemp") → ["Bob", "Moe", "Shemp"]
addNewStudent([null, "Moe", null], "Shemp") → ["Shemp", "Moe", null]

...Save, Compile, Run (ctrl-enter)

public String[] addNewStudent(String[] students, String newStud) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 250 Post-solution available

Copyright Nick Parlante 2017 - privacy