Company: Cashfree_5Dec
Difficulty: medium
Minimum Shifts body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; line-height: 1.5; padding: 20px; } h1, h2 { border-bottom: 1px solid #ccc; padding-bottom: 10px; } pre { background-color: #f6f8fa; border-radius: 6px; padding: 16px; overflow: auto; } code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 1em; } ul { padding-left: 20px; } Minimum Shifts Given a binary matrix, mat , with n rows and m columns where each cell contains either 0 or 1, you can perform shift operations on the rows. In each shift operation, you can cyclically shift the values of any row to the left or right. In a cyclic left shift , the value at each cell (except the first) moves one position to the left, and the first cell's value moves to the end of the row. In a cyclic right shift , the value at each cell (except the last) moves one position to the right, and the