You are given a mn grid. You are asked to generate k mines on this grid randomly. Each cell should have equal probability of k / mn of being chosen. Your algorithm should run in O(m) time.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.