Concise JAVA AC Solution, without Memory error
We can use a set to record chosen point, rather than actually create a big matrix.\nIt will work since there are only 1000 flipping.\n\n\nclass Solution {\n    
We can use a set to record chosen point, rather than actually create a big matrix.\nIt will work since there are only 1000 flipping.\n\n```\nclass Solution {\n    \n    Set<String> chosen = new HashSet<>();\n    int x, y;\n    Random rand = new Random();\n    \n    public Solution(int n_rows, int n_cols) {\n        x = n_rows;\n        y = n_cols;\n    }\n    \n    public int[] flip() {\n        int nx = rand.nextInt(x), ny = rand.nextInt(y);\n        while(chosen.contains(nx + "+" + ny)){\n            nx = rand.nextInt(x);\n            ny = rand.nextInt(y);\n        }\n        chosen.add(nx + "+" + ny);\n        return new int[]{nx, ny};\n    }\n    \n    public void reset() {\n        chosen = new HashSet<>();\n    }\n}\n```
[]