Intern — Middle
Creating a zip function to merge two arrays
livecode
Task condition
It is necessary to implement a zip function that:
- Takes two slices a and b (which can be of different lengths).
- Returns a two-dimensional slice [][]int, where each nested element is a pair [a[i], b[i]].
- If the sizes of the input slices differ, the union continues only up to the minimum of their sizes.
It is required to write a zip function that:
Takes two slices s1 and s2 (which may be of different lengths).
Returns a slice of slices [][]int, where each element is a pair [s1[i], s2[i]].
If the lengths of the slices do not match, the union occurs until the end of the shorter slice