Python. Solution driven by configuration. Beats 80%
Intuition\nThere are eight direction king can be attacked. rather than trace each queen\'s ability to hit king, we can define 8 traces starrting from king posit
# Intuition\nThere are eight direction king can be attacked. rather than trace each queen\'s ability to hit king, we can define 8 traces starrting from king position, like waive, and increase radious of wave on each ste.\nNot super optimal, but very elegant.\n\nPlease add your like\n\n# Approach\nSame as intuition, plus stop trace direction once we detect queen.\n\n# Complexity\n- Time complexity:\nO(N)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def queensAttacktheKing(self, queens: List[List[int]], king: List[int]) -> List[List[int]]:\n        directions = [\n            [0,1],  [1,0], [1,1],\n            [0,-1], [-1,0],[-1,-1],\n            [-1,1], [1,-1]\n        ]\n        \n        # reformat queens positions\n        qs = set( [f"{i}_{j}" for i, j in queens] )\n        ret = []\n\n        step = 1\n        while directions:\n            pos_to_remove = set()\n            for pos, d in enumerate(directions):\n                #print(step, d, directions)\n                \n                check_pos = [king[0]+ d[0]*step, king[1] + d[1]*step]                \n                # if check_pos outside board - remove it\n                if  not 8 >= check_pos[0] >= 0 or not 8 >= check_pos[1] >= 0:                    \n                    pos_to_remove.add(pos)\n                    #print(f"\\tout")\n                elif f"{check_pos[0]}_{check_pos[1]}" in qs:\n                    #print(f"\\tmatch")\n                    pos_to_remove.add(pos)\n                    ret.append( check_pos )\n                \n            directions = [d for p, d in enumerate(directions) if not p in pos_to_remove]\n                     \n            step+=1\n        return ret\n```
['Python3']