Group Todos By User

Write a function groupTodosByUser(todos) that takes an array of todo objects, each shaped { userId, title }, and returns a plain object whose keys are the string form of each userId and whose values are arrays of that user's titles in the order they appeared in the input.

The order of titles inside each bucket must match the input order. An empty input array returns an empty object.

Examples
Input: []
Output: {}
Hints

Group Todos By User

Group a list of todos by their userId, collecting each user's todo titles into an array while preserving the original order.