Company: Amazon
Role : SDE 6M Intern
problem
Give a 2D matrix of size nxn which contains only 0's and 1's and given an integer k, the matrix contains k^2 1's. find the minimum number of swaps required to group all 1's in submatrix of size k*k.
I was able to give the brute force approach but unable to optimize it.
Here is my interview experience