Given a 2d array of size nxm, a selection is defined as an array of integers such that it contains at least ceil(m/2) integers frm each row of the array. The cost of the selection is defined as the maximum difference between any 2 integers in the selection.
If k is the minimum cost of all the possible selections for the given 2d array, find the maximum value ofthe product k*number of integers in the selection by implementing the function long getMaxProduct(int[][] arr).
It seems like a dp problem to me, but no idea how to implement it