This question already has an answer here:
- How to add lists with unequal length? 4 answers
If I have hundreds of vectors of unequal length that I need to sum, what is the cleanest way to do so?
So, if I have as input
I want the answer
I can see how to do this by finding the length of the longest element and then using
PadRight to make the others match, like so
Total[Map[PadRight[#, Max[Map[Length[#] &, inp]]] &, inp]]
but this feels inelegant. Is there a better way?