Add Column Offsets
grid is a 2-D array and offsets is a 1-D array with one number per column. Return a new array where offsets[j] has been added to every cell in column j.
Example 1
grid [[1,2,3],[4,5,6]]
offsets [10,20,30]
returns [[11,22,33],[14,25,36]]
Column 0 gets +10, column 1 gets +20, column 2 gets +30.
Constraints
1 <= rows, columns <= 10len(offsets)equals the number of columns
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Age GroupsEasy
- All DifferentEasy
- Average of Chosen RowsEasy
- Average of Top ThreeEasy
- Biggest JumpEasy
- Brighten ImageEasy
- Bucket CountsEasy
- Busiest ColumnEasy