EasyPythonJavaScriptTypeScript
Zip Arrays
ArraysFunctions
Implement solve(...arrays) that combines multiple arrays element-by-element,
returning an array of tuples. The result length equals the length of the
shortest input array.
Examples
solve([1,2,3], ['a','b','c'])→[[1,'a'],[2,'b'],[3,'c']]solve([1,2], ['a','b','c'], [true,false])→[[1,'a',true],[2,'b',false]]solve()→[]
Sample tests
Test #1Two equal-length arrays
Input: [[1,2,3],["a","b","c"]]
Output: [[1,"a"],[2,"b"],[3,"c"]]
Test #2Single array → each element wrapped in a tuple
Input: [[1,2,3]]
Output: [[1],[2],[3]]
Test #3Three equal-length numeric arrays
Input: [[10,20,30],[1,2,3],[100,200,300]]
Output: [[10,1,100],[20,2,200],[30,3,300]]
Test #4Three arrays, clipped to shortest
Input: [[1,2],["a","b","c"],[true,false]]
Output: [[1,"a",true],[2,"b",false]]
Test #5One empty array → empty result
Input: [[],[1,2,3]]
Output: []