Group Messages by Sender
Medium📝 Description
Group messages by sender in a dictionary.
Input Format
[ {"sender": "Alice", "message": "Hi"}, {"sender": "Alice", "message": "Hey"} ]
Output Format
{ "Alice": ["Hi", "Hey"] }
Constraints
Number of messages ≤ 10^5
🔍 Sample Input
[ {"sender": "Alice", "message": "Hi"}, {"sender": "Alice", "message": "Hey"} ]
✅ Sample Output
{ "Alice": ["Hi", "Hey"] }
Code Editor
Please login to run and submit code.
Results
Suggested Solution
Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run