chauhanshivam079's blog

By chauhanshivam079, history, 2 years ago, In English

You are given a 2D array arr of size N x M . In one operation you can either decrease or increase any element of arr by 1. Find the minimum number of operations needed to make every row and column of arr a palindrome, Note: A sequence B of size K is a palindrome if Bli] = B[K-i-1] for 0 <= i<k Input Format The first line contains an integer, N, denoting the number of rows in arr. The next line contains an integer, M, denoting the number of columns in arr Each line i of the N subsequent lines (where 0 si < N) contains M space separated integers each describing the row arr[i].

How will we solve this Question

  • Vote: I like it
  • -4
  • Vote: I do not like it