Premium problem62. Sum via Iterator

Medium Locked

Given arrays A of shape (3, 1) and B of shape (1, 3), return their broadcasted sum as a (3, 3) array:

  • iterate over matching elements one at a time
  • do not rely on a single vectorized + expression

Input

A =
[[0]
 [1]
 [2]]
B = [[0 1 2]]

Output

[[0 1 2]
 [1 2 3]
 [2 3 4]]

Premium problem

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

Implement solve(...)