Java Hash Set
\n    public List<List<Integer>> queensAttacktheKing(int[][] qs, int[] kg) {\n        List<List<Integer>> res = new ArrayList<>();\n        Set<Integer> set = n
```\n    public List<List<Integer>> queensAttacktheKing(int[][] qs, int[] kg) {\n        List<List<Integer>> res = new ArrayList<>();\n        Set<Integer> set = new HashSet<>();\n        for (int[] q : qs) set.add(q[0] * 16 + q[1]);\n        for (int i = -1; i < 2; i++) {\n            for (int j = -1; j < 2; j++) {\n                for (int k = 1; k < 8; k++) {\n                    int r = kg[0] + i * k, c = kg[1] + j * k;\n                    if (set.contains(r * 16 + c)) {\n                        res.add(List.of(r, c));\n                        break;\n                    }\n                }\n            }\n        }\n        return res;\n    }\n```
[]