about | help | code help+videos | done | prefs |
We have data for two users, A and B, each with a String name and an int id. The goal is to order the users such as for sorting. Return -1 if A comes before B, 1 if A comes after B, and 0 if they are the same. Order *first* by the id numbers, and then by the String names if the id numbers are the same. myCompare("zz", 1, "bb", 2) → -1 myCompare("zz", 3, "bb", 2) → 1 myCompare("bb", 1, "zz", 1) → -1 ...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: 200 Post-solution available
Copyright Nick Parlante 2017 - privacy