Can Someone solve this question Which I had encountered in Amazon SDE 6M Intern Interview
Anonymous User
855

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

https://leetcode.com/discuss/interview-experience/1657948/amazon-sde1-6m-internship-oncampus-december-2021/1200345

Comments (4)