Checking in all 8 Directions
\nclass Solution {\npublic:\n    bool isValid(int i,int j,int m,int n)\n    {\n        return i>=0 && j>=0 && i<m && j<n;\n    }\n    vector<vector<int>> queens
```\nclass Solution {\npublic:\n    bool isValid(int i,int j,int m,int n)\n    {\n        return i>=0 && j>=0 && i<m && j<n;\n    }\n    vector<vector<int>> queensAttacktheKing(vector<vector<int>>& queens, vector<int>& king) {\n        \n        int kX=king[0],kY=king[1];\n        \n        int rows[8]={0,0,-1,+1,+1,-1,+1,-1};        //all directions coordinates\n        int cols[8]={-1,+1,0,0,+1,-1,-1,+1};\n        \n        map<pair<int,int>,int>q;\n        for(auto pts:queens)\n        {\n            q[{pts[0],pts[1]}]++;\n        }\n        vector<vector<int>>ans;\n        for(int index=0;index<8;index++)        //searching in all possible directions;\n        {\n            int i=kX,j=kY;    \n            \n            while(isValid(i,j,8,8))\n            {\n                i+=rows[index];\n                j+=cols[index];\n                if(q.find({i,j})!=q.end())\n                {\n                    ans.push_back({i,j});\n                    break;\n                }\n            }\n        }\n        return ans;\n        \n    }\n};\n```
['C']