FunctionRacerProblemsRace

Pairwise Sums

MediumNumPyPython

Return a 2-D array with len(a) rows and len(b) columns, where the cell at row i, column j is a[i] + b[j]. Hint: turn a into a column with a.reshape(-1, 1) and let broadcasting do the rest.

Example 1

a [1,2]
b [10,20,30]
returns [[11,21,31],[12,22,32]]

Row 0 is [11, 21, 31] and row 1 is [12, 22, 32].

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More NumPy problems