Simple Code in Python
\n```\n#Searching with respet to king as he is the target\nclass Solution:\n    def queensAttacktheKing(self, queens: List[List[int]], king: List[int]) -> List[
\n```\n#Searching with respet to king as he is the target\nclass Solution:\n    def queensAttacktheKing(self, queens: List[List[int]], king: List[int]) -> List[List[int]]:\n        ans = []\n        chess = [[0 for i in range(8)] for j in range(8)]\n        #marking queens\n        for i in queens:\n            chess[i[0]][i[1]] = 1\n        """\n            left : [-1,0],\n            right: [1,0],\n            up: [0,-1],\n            down: [0,1],\n            top-left: [-1,-1],\n            top-right: [1,-1],\n            bottom-left: [-1,1],\n            bottom-right: [1,1]\n        """\n        directions = [[-1,0],[1,0],[0,-1],[0,1],[-1,-1],[1,-1], [-1,1],[1,1]]\n        for i in directions:\n            kx,ky = king[0]+i[0], king[1]+i[1]\n            while kx in range(8) and ky in range(8):\n                if chess[kx][ky] == 1:\n                    ans.append([kx,ky])\n                    break\n                kx = kx + i[0]\n                ky = ky + i[1]\n        return ans\n
[]