JAVA 85% fast, 2ms, explanation with code
If you found the solution helpful, kindly upvote. :)\n\n\nclass Solution {\n    public List<List<Integer>> queensAttacktheKing(int[][] queens, int[] king) {\n  
If you found the solution helpful, kindly upvote. :)\n\n```\nclass Solution {\n    public List<List<Integer>> queensAttacktheKing(int[][] queens, int[] king) {\n        \tList<List<Integer>> res= new ArrayList<List<Integer>>();\n    \t//This array will store all the possible positions of the queen\n    \tboolean[][] seen= new boolean[8][8]; \n    \tfor(int[] q:queens)\n        {\tseen[q[0]][q[1]]=true; }\n    \t\n    \t//Now we make a direction array\n    \tint[] direction= {-1,0,1};\n    \t\n    \tfor(int dx:direction)\n    \t{\n    \t\tfor(int dy:direction)\n    \t\t{\n    \t\t\t//These 2 loops ensure that all the possible directions are covered\n    \t\t\tif(dx==00 && dy==0) continue;\n    \t\t\t//Now, we will take the coords of the king and do sort of a BFS\n    \t\t\t\n    \t\t\tint x=king[0];\n    \t\t\tint y=king[1];\n    \t\t\t\n    \t\t\twhile(x+dx >=0 && x+dx<=7 && y+dy >=0 && y+dy<=7)\n    \t\t\t{\n    \t\t\t\tx+=dx; y+=dy;\n    \t\t\t\t//Now we will check if the updated coordinates have the queen or not\n    \t\t\t\tif(seen[x][y])\n    \t\t\t\t{\n    \t\t\t\t\tres.add(Arrays.asList(x,y));\n    \t\t\t\t\tbreak;\n    \t\t\t\t}\n    \t\t\t}\n    \t\t}\n    \t}\n    \treturn res;\n    }\n}\n```
[]