You are given a binary rectangular matrix with exactly five columns. A matrix is called good if it contains exactly columns[i] ones in the i-th column. To make the matrix good, you are allowed to perform at most maxMoveCount moves. With each move, you select a row of the matrix and circularly shift it to the right by 1 position (so, for example, row {0, 0, 1, 0, 0} becomes {0, 0, 0, 1, 0}).
Given matrix, columns and maxMoveCount, return the lexicographically greatest good matrix you can achieve. If you can not achieve any good matrix, return an empty String[]. To compare two matrices lexicographically, concatenate all rows starting from the top for each of the matrices and compare the resulting strings. String A is lexicographically greater than string B if it contains the bigger character at the first position where they differ.
|