C++ Solution (Using DFS) :  Easy To Understand
class Solution {\npublic:\n\n    // Possible directions \n    vector> dirs = {{1,0},{-1,0},{0,1},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}} ;\n    \n    bool dfs(vecto
class Solution {\npublic:\n\n    // Possible directions \n    vector<vector<int>> dirs = {{1,0},{-1,0},{0,1},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}} ;\n    \n    bool dfs(vector<int> queen, vector<int>& d, vector<int>& king, set<vector<int>>& s)\n    {\n        if (queen[0]<0||queen[1]<0||queen[0]>=8||queen[1]>=8)\n            return false ;\n        if (queen == king)\n            return true ;\n        \n        if (!s.count({queen[0]+d[0],queen[1]+d[1]}))\n        {\n            if (dfs({queen[0]+d[0],queen[1]+d[1]}, d, king, s))\n                return true ;\n        }\n        \n        return false ;\n    }\n    // DFS\n    // for each possible direction, check if you can kill the king. \n    // If a black queen blocks your path, you can\'t\n    vector<vector<int>> queensAttacktheKing(vector<vector<int>>& queens, vector<int>& king) {\n        \n        vector<vector<int>> res ;\n        set<vector<int>> s(queens.begin(), queens.end()) ;\n        \n        for (auto x: queens)\n        {\n            for (auto d : dirs)\n            {\n                if (dfs(x,d,king,s))\n                {\n                    res.push_back(x) ;\n                    break ;\n                }\n            }\n        }\n        return res ;\n        \n    }\n};
[]