Search
⌘K

Leetcode 519. Random Flip Matrix

Implement a class that repeatedly returns and flips a uniformly random unpicked cell (i, j) from an m×n zero-initialized binary matrix and can reset the matrix. Each flip must pick every remaining zero cell with equal probability while minimizing calls to the random function and optimizing time and space per operation.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.