From a kings perspective
Idea is to see from kings perspective. Steps as follows\n Start from kings position\n Walk straight in x axis, y axis and diagnol\n If we meet a queen, add that
Idea is to see from kings perspective. Steps as follows\n* Start from kings position\n* Walk straight in x axis, y axis and diagnol\n* If we meet a queen, add that to result and return\n* Return if we reach the end of the chessboard\n```\nclass Solution:\n    def dfs(self, x, y, visited,dim):\n        if visited[x][y] ==\'Q\':\n            self.ans.append([x,y])\n            return\n        k = dim[0]+x\n        l = dim[1]+y\n        if k >= 0 and l >= 0 and k < 8 and l < 8:\n            self.dfs(k,l, visited,dim)\n    \n    def queensAttacktheKing(self, queens: List[List[int]], king: List[int]) -> List[List[int]]:\n        self.dims = [[1,0],[0,1],[-1,0],[0,-1],[1,1],[-1,-1],[1,-1],[-1,1]]\n        visited = [[False for i in range(8)] for j in range(8)]\n        for q in queens:\n            visited[q[0]][q[1]] = \'Q\'\n        self.ans = []\n        for dim in self.dims:\n            k = king[0]+dim[0]\n            l = king[1]+dim[1]\n            if  k>= 0 and  l>= 0 and k < 8 and l < 8 :\n                self.dfs(king[0],king[1],visited, dim)\n        return self.ans\n```
[]