c++ | simple | easy to understand
```\nclass Solution {\npublic:\n    vector> queensAttacktheKing(vector>& queens, vector& king) {\n        vector > ans;\n        int row = king[0], col = king[1
```\nclass Solution {\npublic:\n    vector<vector<int>> queensAttacktheKing(vector<vector<int>>& queens, vector<int>& king) {\n        vector<vector<int> > ans;\n        int row = king[0], col = king[1];\n        vector<vector<bool> > queen(8, vector<bool>(8, false));\n        \n        for(auto &q: queens) \n            queen[q[0]][q[1]] = true;\n        \n        //west side\n        for(int j=col-1; j>=0; j--){\n            if(queen[row][j]){\n                ans.push_back({row, j});\n                break;\n            }\n        }\n        \n        //east side\n        for(int j=col+1; j<8; j++){\n            if(queen[row][j]){\n                ans.push_back({row, j});\n                break;\n            }\n        }\n        \n        //north side\n        for(int i=row-1; i>=0; i--){\n            if(queen[i][col]){\n                ans.push_back({i, col});\n                break;\n            }\n        }\n        \n        //south side\n        for(int i=row+1; i<8; i++){\n            if(queen[i][col]){\n                ans.push_back({i, col});\n                break;\n            }\n        }\n        \n        //north west side\n        for(int i=row-1, j=col-1; i>=0 && j>=0; i--, j--){\n            if(queen[i][j]){\n                ans.push_back({i, j});\n                break;\n            }\n        }\n        \n        //south west side\n        for(int i=row+1, j=col-1; i<8 && j>=0; i++, j--){\n            if(queen[i][j]){\n                ans.push_back({i, j});\n                break;\n            }\n        }\n        \n        //south east side\n        for(int i=row+1, j=col+1; i<8 && j<8; i++, j++){\n            if(queen[i][j]){\n                ans.push_back({i, j});\n                break;\n            }\n        }\n        \n        //north east side\n        for(int i=row-1, j=col+1; i>=0 && j<8; i--, j++){\n            if(queen[i][j]){\n                ans.push_back({i, j});\n                break;\n            }\n        }\n        \n        return ans;\n    }\n};
[]