2D Array Anti-Diagonal Traversal
Consider the following code segment:
int[][] cells = {
{4, 1, 7},
{6, 5, 3},
{2, 8, 0}
};
int sum = 0;
for (int x = 0; x < cells.length; x++) {
sum += cells[x][cells[0].length - 1 - x];
}
What will be the value of sum after the code has
executed?
A
10
B
15
C
18
D
14
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE