C++ | Basic | Draw lines of attack from the king until you hit a queen
```\nclass Solution {\npublic:\n    vector> queensAttacktheKing(vector>& queens, vector& king) \n    {\n        vector> dirs = {\n            {1, 0},\n         
```\nclass Solution {\npublic:\n    vector<vector<int>> queensAttacktheKing(vector<vector<int>>& queens, vector<int>& king) \n    {\n        vector<pair<int, int>> dirs = {\n            {1, 0},\n            {1, 1},\n            {0, 1},\n            {-1, 1},\n            {-1, 0},\n            {-1, -1},\n            {0, -1},\n            {1, -1}\n        };\n        vector<vector<int>> result;\n        \n        vector<vector<bool>> board(8, vector<bool>(8));\n        \n        for(auto& queen : queens)\n        {\n            board[queen[0]][queen[1]] = true;\n        }\n        \n        for(auto [x, y] : dirs)\n        {\n            int ni = king[0];\n            int nj = king[1];\n            \n            while(ni >= 0 and ni < 8 and nj >= 0 and nj < 8 and not board[ni][nj])\n            {\n                ni += x;\n                nj += y;\n            }\n            if(ni >= 0 and ni < 8 and nj >= 0 and nj < 8)\n            {\n                result.push_back({ni, nj});\n            }\n        }\n        \n        return result;\n    }\n};
['Backtracking', 'C']