← ALL NOTES
Array

1536. Minimum Swaps to Arrange a Binary Grid

Given an n×n binary grid, one operation swaps two adjacent rows; find the minimum swaps so that above the main diagonal (to the right of the diagonal) every cell is 0, or −1. Row i needs at least…

Loading…