- Type: Array (greedy)
- Approach:
- Try make A[0] in a whole row, the condition is that A[i] == A[0] || B[i] == A[0], a and b are the number of swap to make a whole row A[0].
- Try B[0], the condition is that A[i] == B[0] || B[i] == B[0], a and b are the number of swap to make a whole row B[0].
- Return -1.
- Complexity:
- Time: O(n)
- Space: O(1)