##
Count inversion pairs in a matrix
January 7, 2017

Given a matrix A of size NxN, we need to find the number of inversion pairs in it. Inversion count in a matrix is defined as the number of pairs satisfying the following conditions : x1 ≤ x2 y1 ≤ y2 A[x2][y2] < A[x1][y1] Constraints : 1 ≤ Ai,j ≤ 109 1 ≤ N ≤… Read More »