C++ || 100% faster || 93% space efficient
\nclass Solution {\npublic:\n    vector<vector<int>> queensAttacktheKing(vector<vector<int>>& queens, vector<int>& king) {\n        int x=king[0];\n        int 
```\nclass Solution {\npublic:\n    vector<vector<int>> queensAttacktheKing(vector<vector<int>>& queens, vector<int>& king) {\n        int x=king[0];\n        int y=king[1];\n        \n        vector<vector<int>> ans;\n        \n        int a[8][8];\n        memset(a,0,sizeof(a));\n        \n        for(int i=0;i<queens.size();i++)\n        {\n            a[queens[i][0]][queens[i][1]]=1;\n        }\n        \n        a[x][y]=2;\n        \n        for(int i=y+1;i<8;i++)\n        {\n            if(a[x][i]==1)\n            {\n                ans.push_back({x,i});\n                break;\n            }\n        }\n        \n        for(int i=y-1;i>=0;i--)\n        {\n            if(a[x][i]==1)\n            {\n                ans.push_back({x,i});\n                break;\n            }\n        }\n        \n        for(int i=x+1;i<8;i++)\n        {\n            if(a[i][y]==1)\n            {\n                ans.push_back({i,y});\n                break;\n            }\n        }\n        \n        for(int i=x-1;i>=0;i--)\n        {\n            if(a[i][y]==1)\n            {\n                ans.push_back({i,y});\n                break;\n            }\n        }\n        \n        int i=x+1,j=y+1;\n        while(i<8 and j<8)\n        {\n            if(a[i][j]==1)\n            {\n                ans.push_back({i,j});\n                break;\n            }\n            ++i;\n            ++j;\n        }\n        \n        i=x+1,j=y-1;\n        while(i<8 and j>=0)\n        {\n            if(a[i][j]==1)\n            {\n                ans.push_back({i,j});\n                break;\n            }\n            ++i;\n            --j;\n        }\n        \n        i=x-1,j=y-1;\n        while(i>=0 and j>=0)\n        {\n            if(a[i][j]==1)\n            {\n                ans.push_back({i,j});\n                break;\n            }\n            --i;\n            --j;\n        }\n        \n        i=x-1,j=y+1;\n        while(i>=0 and j<8)\n        {\n            if(a[i][j]==1)\n            {\n                ans.push_back({i,j});\n                break;\n            }\n            --i;\n            ++j;\n        }\n        \n        return ans;\n    }\n};\n```
[]