java easy 100 ms solution well commented
\nclass Solution {\n    public List<List<Integer>> queensAttacktheKing(int[][] queens, int[] king) {\n        //----------------------------------\n        List
```\nclass Solution {\n    public List<List<Integer>> queensAttacktheKing(int[][] queens, int[] king) {\n        //----------------------------------\n        List<List<Integer>> list=new ArrayList<>();\n        int king_x=king[0];\n        int king_y=king[1];\n        int[][] chess=new int[8][8];\n        chess[king_x][king_y]=1;// identifier of king is one\n        for(int i=0;i<queens.length;i++){\n            int x=queens[i][0];\n            int y=queens[i][1];\n            // identifier of queen is -1\n            chess[x][y]=-1;\n           \n        }\n        \n        \n        //------------------------------\n        // lets check in row( left side of king)\n        for(int i=king_y;i>=0;i--){\n            List<Integer> l=new ArrayList<>();\n            if(chess[king_x][i]==-1){\n                l.add(king_x);\n                l.add(i);\n                list.add(l);\n                break;\n            }\n        }\n        // lets check in row (right side of king)\n        for(int i=king_y;i<chess[0].length;i++){\n            List<Integer> l=new ArrayList<>();\n            if(chess[king_x][i]==-1){\n                l.add(king_x);\n                l.add(i);\n                list.add(l);\n                break;\n            }\n        }\n        \n        // lets look in the column up to the king\n        for(int i=king_x;i>=0;i--){\n             List<Integer> l=new ArrayList<>();\n            if(chess[i][king_y]==-1){\n                l.add(i);\n                l.add(king_y);\n                list.add(l);\n                break;\n                \n            }\n            \n        }\n        //lets look for in the column down to the king\n        for(int j=king_x;j<chess.length;j++){\n            List<Integer> l=new ArrayList<>();\n            if(chess[j][king_y]==-1){\n                l.add(j);\n                l.add(king_y);\n                list.add(l);\n                break;\n                \n            }\n        }\n        //------- lets check in diagonal\n    // looking up diagonal to the king\n         for(int i=king_x,j=king_y;i>=0 && j>=0;i--,j--){\n            List<Integer> l=new ArrayList<>();\n            if(chess[i][j]==-1){\n                l.add(i);\n                l.add(j);\n                list.add(l);\n                break;\n            }\n        }\n          \n        \n        //looking down diagonal to the king \n        for(int i=king_x,j=king_y;i<chess.length && j<chess[0].length;i++,j++){\n            List<Integer> l=new ArrayList<>();\n            if(chess[i][j]==-1){\n                l.add(i);\n                l.add(j);\n                list.add(l);\n                break;\n            }\n        }\n        \n        // looking for secondry up_diagonal\n         for(int i=king_x,j=king_y;i>=0 && j<chess[0].length;i--,j++){\n            List<Integer> l=new ArrayList<>();\n            if(chess[i][j]==-1){\n                l.add(i);\n                l.add(j);\n                list.add(l);\n                break;\n            }\n        }\n        //---------------------looking for secondry down diagonal\n           for(int i=king_x,j=king_y;i<chess.length && j>=0;i++,j--){\n            List<Integer> l=new ArrayList<>();\n            if(chess[i][j]==-1){\n                l.add(i);\n                l.add(j);\n                list.add(l);\n                break;\n            }\n        }\n          \n        \n\n        return list;\n    }\n    \n  \n}\n// do upvote if you like it\n```
['Java']