Build the Reverse Lookup

Intermediate

You have a name-to-score map but need to answer "who scored X?". With scores unique, invert the map so values become keys.

Implement `solve(Map<String,Integer> scores)` (unique values) to return a Map<Integer, String> with keys and values swapped.

Examples

Input{alice=90, bob=85, cara=95}
Output{90=alice, 85=bob, 95=cara}
Hints
  • Iterate keySet(), put value -> key.
Anonymous Apex

Your code runs in a secure sandbox against multiple hidden test cases. The problem is solved only when every test passes. Each run is isolated and any data changes are rolled back automatically.