Java Solution - Easy to Understand.
\nclass Solution {\n    public List<List<Integer>> queensAttacktheKing(int[][] queens, int[] king) {\n        List<List<Integer>> result = new ArrayList<>();\n 
```\nclass Solution {\n    public List<List<Integer>> queensAttacktheKing(int[][] queens, int[] king) {\n        List<List<Integer>> result = new ArrayList<>();\n        //Looping through and keeping track of all the queens on the board\n        boolean[][] board = new boolean[8][8];\n        for(int i=0;i<queens.length;i++)\n            board[queens[i][0]][queens[i][1]] = true;\n        //All the directions in which the king can move.\n        int[][] directions = {{1,0},{-1,0},{0,1},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};\n        int king_X = king[0];\n        int king_Y = king[1];\n        for(int i=0;i<directions.length;i++)\n        {\n            int x = directions[i][0];\n            int dupX = x;\n            int y = directions[i][1];\n            int dupY = y;\n            boolean found = false;\n            \n            while((king_X+x)>=0 && (king_X+x)<8 && (king_Y+y)>=0 && (king_Y+y)<8  && !found)\n            {\n                if(board[king_X+x][king_Y+y])\n                {\n                    List<Integer> list = new ArrayList<>();\n                    list.add(king_X+x);\n                    list.add(king_Y+y);\n                    result.add(list);\n                    found = true;\n                }\n                x = x+dupX;\n                y = y+dupY;\n            }\n        }\n        return result;\n    }\n}\n```
[]