Multiplication Table
Return an n x n array where the cell in row i and column j (counting from 0) is (i + 1) * (j + 1). So the first row is 1, 2, 3, ... and the first column is also 1, 2, 3, ... Use broadcasting instead of loops.
Example 1
n 3
returns [[1,2,3],[2,4,6],[3,6,9]]
The rows are [1, 2, 3], [2, 4, 6] and [3, 6, 9].
Constraints
1 <= n <= 10
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Order by ScoreMedium
- Pairs Hitting TargetMedium
- Pairwise SumsMedium
- Path LengthMedium
- Rank of Each ScoreMedium
- Ranks Without GapsMedium
- Record HighsMedium
- Risk of a MixMedium