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


  1. A.

    0

  2. B.

    n − 1

  3. C.

    n² − 3n + 2

  4. 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.

image.png

Explore the full course: Gate Guidance By Sanchit Sir