Premium problem55. Enumerate a 2D Array

Medium Locked

Return a list of (index, value) pairs for every element of the 2-D array Z, in row-major order, where index is a (row, col) tuple and value is an int.

Input

[[0 1 2]
 [3 4 5]
 [6 7 8]]

Output

[((0, 0), 0), ((0, 1), 1), ((0, 2), 2), ((1, 0), 3), ((1, 1), 4), ((1, 2), 5), ((2, 0), 6), ((2, 1), 7), ((2, 2), 8)]

Premium problem

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

Implement solve(...)