Premium problem113. Stack Two Matrices Along a New Axis

Medium Locked

Given two 2-D arrays a and b of the same shape, stack them along a new third axis so the result has shape (rows, cols, 2), with a at index 0 and b at index 1 of that new axis.

Input

a =
[[1 2]
 [3 4]]
b =
[[5 6]
 [7 8]]

Output

[[[1 5]
  [2 6]]

 [[3 7]
  [4 8]]]

Premium problem

This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.

Implement solve(...)