TATA ELXSI interview question

Operation based on 2D array.