Company Name | YOE (Payscale) | Question |
---|---|---|
HashedIn | 3 | users = [ |
{"name": "Alice", "age": 30, "location": "New York"}, | ||
{"name": "Bob", "age": 25, "location": "Paris"}, | ||
{"name": "Charlie", "age": 35, "location": "New York"}, | ||
{"name": "David", "age": 30, "location": "London"}, | ||
{"name": "Eve", "age": 22, "location": "Paris"} | ||
] |
Write a function in Python that groups the users by their location and returns a dictionary where the keys are locations and the values are lists of user names in that location, sorted alphabetically.
e.g. { ‘New York’:[’Alice’,’Charlie’] | | HashedIn | 3 | Input: [100, 4, 200, 1, 3, 2] find the longest consecutive sequence of number. e.g. [1,2,3,4] | | | | | | | | | | | | | | | | |