Pair with given sum in matrix
Given a NxM matrix and a sum S. The task is to check if a pair with given Sum exists in the matrix or not. Examples: Input: mat[N][M] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 16}}; sum = 31 Output: YES Input: mat[N][M] = {{1, 2, 3, 4}, {5, 6, 7, 8}}; sum = 150 Output: NO Approach