FunctionRacerProblemsRace

Names in Order

BeginnerSorting and searchingPython, JavaScript, TypeScript, Java, C++

Return the names of names in alphabetical order, ignoring upper and lower case: "bob" comes before "Cleo", and "adam" before "Bob". Every name keeps its own spelling in the answer.

Names that are equal once case is ignored, like "amy" and "AMY", keep the order they had in names.

Example 1

names ["bob","Cleo","adam"]
returns ["adam","bob","Cleo"]

Without case the order is adam, bob, cleo. A plain sort would put "Cleo" first, because capital letters sort before small ones.

Example 2

names ["amy","AMY","Al"]
returns ["Al","amy","AMY"]

"Al" comes first. "amy" and "AMY" are equal without case, so they stay in their original order.

Example 3

names []
returns []

An empty list stays empty.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Sorting and searching problems