Bucket Names into a Directory
Intermediate SolvedA contact directory groups people under alphabetical headers. Group a list of names by their lower-case first letter, preserving each group’s original order.
Implement `solve(List<String> names)` to return a Map<String, List<String>> keyed by lower-case first letter, each value the names starting with it in original order.
Examples
Input
["Ana", "Bob", "Amy"]Output
{a=[Ana, Amy], b=[Bob]}Hints
- Derive the key, lazily create the bucket list, then append.
Tests
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.