BAD coding but still works
\npublic static List<List<Integer>> queensAttacktheKing(int[][] queens, int[] king) {\n        List<List<Integer>> queen = new LinkedList<>();\n        List<Lis
```\npublic static List<List<Integer>> queensAttacktheKing(int[][] queens, int[] king) {\n        List<List<Integer>> queen = new LinkedList<>();\n        List<List<Integer>> result = new ArrayList<>();\n        for (int[] a : queens) {\n            List<Integer> ans = new ArrayList<>();\n            ans.add(a[0]);\n            ans.add(a[1]);\n            queen.add(ans);\n        }\n        int x = king[0];\n        int y = king[1];\n        for (int i = x; i < 8; i++) {\n            List<Integer> temp = new ArrayList<>();\n            temp.add(i);\n            temp.add(y);\n            if (queen.contains(temp)) {\n                result.add(temp);\n                break;\n            }\n        }\n        for (int i = x; i >= 0; i--) {\n            List<Integer> temp = new ArrayList<>();\n            temp.add(i);\n            temp.add(y);\n            if (queen.contains(temp)) {\n                result.add(temp);\n                break;\n            }\n        }\n\n        for (int i = y; i < 8; i++) {\n            List<Integer> temp = new ArrayList<>();\n            temp.add(x);\n            temp.add(i);\n            if (queen.contains(temp)) {\n                result.add(temp);\n                break;\n            }\n        }\n        for (int i = y; i >= 0; i--) {\n            List<Integer> temp = new ArrayList<>();\n            temp.add(x);\n            temp.add(i);\n            if (queen.contains(temp)) {\n                result.add(temp);\n                break;\n            }\n        }\n\n        for (int i = 0; i < 8; i++) {\n            List<Integer> temp = new ArrayList<>();\n            temp.add(x + i);\n            temp.add(y + i);\n            if (queen.contains(temp)) {\n                result.add(temp);\n                break;\n            }\n        }\n        for (int i = 1; i < 8; i++) {//\n            List<Integer> temp = new ArrayList<>();\n            temp.add(x - i);\n            temp.add(y - i);\n            if (queen.contains(temp)) {\n                result.add(temp);\n                break;\n            }\n        }\n\n        for (int i = 0; i < 8; i++) {\n            List<Integer> temp = new ArrayList<>();\n            temp.add(x + i);\n            temp.add(y - i);\n            if (queen.contains(temp)) {\n                result.add(temp);\n                break;\n            }\n        }\n        for (int i = 0; i < 8; i++) {\n            List<Integer> temp = new ArrayList<>();\n            temp.add(x - i);\n            temp.add(y + i);\n            if (queen.contains(temp)) {\n                result.add(temp);\n                break;\n            }\n        }\n\n        return result;\n    }\n```\n\nCan anyone tell me complexity of this code
[]