2718. Sum of Matrix After Queries
You are given an integer
n
and a 0-indexed 2D arrayqueries
wherequeries[i] = [typei, indexi, vali]
.Initially, there is a 0-indexed
n x n
matrix filled with0
‘s. For each query, you must apply one of the following changes:
- if
typei == 0
, set the values in the row withindexi
tovali
, overwriting any previous values.- if
typei == 1
, set the values in the column withindexi
tovali
, overwriting any previous values.Return the sum of integers in the matrix after all queries are applied.
c++
1 |
|