This is a question that I have encountered during an interview:
Write a function to transform the array:
[
{name:'a',values:[1,2]},
{name:'b',values:[3]},
{name:'a',values:[4,5]}
]
to:
[
{name:'a',values:[1,2,4,5]},
{name:'b',values:[3]}
]
I know this is not hard, but I just can't figure it out. Does anyone know how to solve it? Are there any places that I can find and practice more practical questions like this one?