4ms c++
\nclass Solution {\npublic:\n    int rows = 8;\n    int cols = 8;\n    int kx, ky;\n    vector<vector<int>> ans;\n    \n    \n    vector<vector<int>> queensAtta
```\nclass Solution {\npublic:\n    int rows = 8;\n    int cols = 8;\n    int kx, ky;\n    vector<vector<int>> ans;\n    \n    \n    vector<vector<int>> queensAttacktheKing(vector<vector<int>>& queens, vector<int>& king) {\n        \n        kx = king[0];\n        ky = king[1];\n\n        vector<vector<bool>> pos(64, vector<bool>(64));\n        for(auto co: queens)\n        {\n            int x = co[0]; int y = co[1];\n            pos[x][y] = true;     \n        }\n        \n        vector<vector<int>> dirs = {{1, 0}, {-1, 0}, {1, 1}, {-1, -1}, {1, -1}, {-1, 1}, {0, 1}, {0, -1}};\n        \n        \n        for(auto d : dirs)\n        {\n            for(int i = kx+d[0], j = ky+d[1]; i >= 0 && i < 64 && j >= 0 && j < 64; i += d[0], j+=d[1])\n            {\n                if(pos[i][j])\n                    {\n                        ans.push_back({i, j});\n                        break;\n                    }\n            }\n        }\n        return ans;\n        \n    }\n};\n```
[]