[Python] beats 94%, simple and easy to understand
\nclass Solution:\n    def queensAttacktheKing(self, queens: List[List[int]], king: List[int]) -> List[List[int]]:\n        def checkDirection(direction, ans): 
```\nclass Solution:\n    def queensAttacktheKing(self, queens: List[List[int]], king: List[int]) -> List[List[int]]:\n        def checkDirection(direction, ans): # move the king to each direction\n            x, y = king[0], king[1]\n            while 0 <= x < 9 and 0 <= y < 9:\n                if [x, y] in queens: # when encountering a queen, mark the location and return\n                    ans.append([x, y])\n                    return\n                x += direction[0]\n                y += direction[1]\n\n        ans = []\n        for direction in [1, 0], [0, 1], [-1, 0], [0, -1], [-1, -1], [1, 1], [1, -1], [-1, 1]:\n            checkDirection(direction, ans)\n        return ans\n```\n\t\t\nSo the point is, we just move the king (not the queen!) to each direction until it meets a queen. \n\nWhen it happens, simply add its location and return.
[]