Hexaware PCH Hiring Drive 2026 | Diagonal Difference Matrix Analysis & First Non-Repeating Array Element

Hexaware · Question · Posted Jun 2026

Problem 1 - Compute Left and Right Diagonal Absolute Difference Problem Statement You are given a square matrix of integers of size N × N. Compute the absolute difference between the sums of its two main diagonals: Primary Diagonal: Top-left to bottom-right. Secondary Diagonal: Top-right to bottom-left. Return: |Primary Diagonal Sum − Secondary Diagonal Sum| Constraints Constraint 1 ≤ N ≤ 500 -100 ≤ matrix[i][j] ≤ 100 Test Cases Input Output Explanation N = 3 11 2 4 4 5 ...

The full answer & interview discussion are available to premium members.

Log in Create a free account