C++ with comments
\nclass Solution {\npublic:\n    vector<vector<int>> queensAttacktheKing(vector<vector<int>>& queens, vector<int>& king) \n    {\n        vector<vector<int>> an
```\nclass Solution {\npublic:\n    vector<vector<int>> queensAttacktheKing(vector<vector<int>>& queens, vector<int>& king) \n    {\n        vector<vector<int>> ans;\n        \n        // make a grid to track position of queens.\n        vector<vector<bool>> grid(8, vector<bool>(8, false));\n        for(auto v: queens)\n        {\n            grid[v[0]][v[1]] = true; //place queen\n        }\n        \n        // SAME ROW\n        // check queens in same row towards right.\n        for(int j = king[1] + 1 ; j < 8 ; j++) {\n            if(grid[king[0]][j] == true) {\n                ans.push_back({king[0], j});\n                break;\n            }\n        }\n        // check queens in same row towards left.\n        for(int j = king[1] - 1 ; j >= 0 ; j--) {\n            if(grid[king[0]][j] == true) {\n                ans.push_back({king[0], j});\n                break;\n            }\n        }\n        \n        // SAME COLUMN\n        // check queens in same col towards down.\n        for(int i = king[0] + 1 ; i < 8 ; i++) {\n            if(grid[i][king[1]] == true) {\n                ans.push_back({i, king[1]});\n                break;\n            }\n        }\n        // check queens in same col towards up.\n        for(int i = king[0] - 1 ; i >= 0 ; i--) {\n            if(grid[i][king[1]] == true) {\n                ans.push_back({i, king[1]});\n                break;\n            }\n        }\n        \n        // CHECK DIAGONALS\n        // towards top left\n        for(int i = king[0], j = king[1] ; i >= 0 && j >= 0 ; i--, j--) {\n            if(grid[i][j] == true) {\n                ans.push_back({i, j});\n                break;\n            }\n        }\n        // towards top right\n        for(int i = king[0], j = king[1] ; i >= 0 && j < 8 ; i--, j++) {\n            if(grid[i][j] == true) {\n                ans.push_back({i, j});\n                break;\n            }\n        }\n        // towards bottom left\n        for(int i = king[0], j = king[1] ; i < 8 && j >= 0 ; i++, j--) {\n            if(grid[i][j] == true) {\n                ans.push_back({i, j});\n                break;\n            }\n        }\n        // towards bottom right\n        for(int i = king[0], j = king[1] ; i < 8 && j < 8 ; i++, j++) {\n            if(grid[i][j] == true) {\n                ans.push_back({i, j});\n                break;\n            }\n        }\n        \n        return ans;\n    }\n};\n```
['C']