An n × n array v is defined as follows: v[i, j] = i − j for all i, j, 1 ≤ i ≤…
2000
An n × n array v is defined as follows:
v[i, j] = i − j for all i, j, 1 ≤ i ≤ n, 1 ≤ j ≤ n
The sum of the elements of the array v is
- A.
0
- B.
n − 1
- C.
n² − 3n + 2
- D.
n² (n + 1) / 2
Attempted by 462 students.
Show answer & explanation
Correct answer: A
The sum of the ith row and ith column is 0 as shown below. Since the number of rows equals the number of columns, the total sum will be 0.
