100% Faster CPP - BruteForce OP
\n\nvector<vector<int>> queensAttacktheKing(vector<vector<int>>& queens, vector<int>& king) {\n\t\t// All eight directions stored \n        vector<pair<int,int>
```\n\nvector<vector<int>> queensAttacktheKing(vector<vector<int>>& queens, vector<int>& king) {\n\t\t// All eight directions stored \n        vector<pair<int,int>> dir = {{0,1},{1,0},{-1,0},{0,-1},{1,1},{-1,1},{1,-1},{-1,-1}};\n\t\t// res vectore will sotre our result\n        vector<vector<int>> res;\n\t\t// we make a 2d board to create the simulation for our traversal\n        vector<vector<bool>> board(8,vector<bool>(8,false));\n\t\t// mark all the queens present of the board as true\n        for(auto& x: queens)\n        {\n            board[x[0]][x[1]]=true;\n        }\n\t\t// take each coordinate and traverse\n        for(auto& [x,y] : dir)\n        {\n            int ki = king[0];\n            int kj = king[1];\n\t\t\t// traverse till path in valid and when you get your first queen break\n            while(ki>=0 && kj>=0 && ki<8 && kj<8 && board[ki][kj]==false)\n            {\n                ki+=x;\n                kj+=y;\n            }\n\t\t\t// if you get a queen then coordinate would definately be valid so push them in res vector\n            if(ki>=0 && kj>=0 && ki<8 && kj<8)\n                res.push_back({ki,kj});\n        }\n\t\t// return the answer\n        return res;\n    }\n\n```
['C', 'C++']