c++ | backtracking | N-queens like solution | simple
\nclass Solution {\npublic:\n    bool isSafe(int x,int y)\n    {\n        if(x>=0 && y>=0 && x<8 && y<8)\n            return true;\n        return false;\n    }
```\nclass Solution {\npublic:\n    bool isSafe(int x,int y)\n    {\n        if(x>=0 && y>=0 && x<8 && y<8)\n            return true;\n        return false;\n    }\n    void findQueen(vector<vector<int>>& res,int moveX,int moveY,int x,int y,int arr[8][8])\n    {\n        if(isSafe(x,y))\n        {\n            if(arr[x][y])\n            {\n                vector<int> q={x,y};\n                res.push_back(q);\n                return;\n            }\n            findQueen(res,moveX,moveY,x+moveX,y+moveY,arr);\n        }\n    }\n    vector<vector<int>> queensAttacktheKing(vector<vector<int>>& queens, vector<int>& king) {\n        vector<vector<int>> res;\n        int arr[8][8]={0};\n        for (auto q:queens)\n        {\n            arr[q[0]][q[1]]=1;\n        }\n        vector<int> moveX={-1,-1,-1,0,1,1,1,0};\n        vector<int> moveY={-1,0,1,1,1,0,-1,-1};\n        for(int i=0;i<8;i++)\n        {        \n            findQueen(res,moveX[i],moveY[i],king[0]+moveX[i],king[1]+moveY[i],arr);\n        }\n        return res;\n    }  \n};\n```
['Backtracking', 'C']