flip matrix
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def __init__(self, m: int, n: int):\n        self.m = m\n        self.n = n\n        self.total = m * n\n        self.mp = {}\n\n    def flip(self) -> List[int]:\n        self.total -= 1\n        x = random.randint(0, self.total)\n        idx = self.mp.get(x, x)\n        self.mp[x] = self.mp.get(self.total, self.total)\n        return [idx // self.n, idx % self.n]\n\n    def reset(self) -> None:\n        self.total = self.m * self.n\n        self.mp.clear()\n\n\n# Your Solution object will be instantiated and called as such:\n# obj = Solution(m, n)\n# param_1 = obj.flip()\n# obj.reset()\n```
['Python3']