Python, 15 line solution, uses 100% less memory than others
Queens can move in 8 directions, so I start at the king\'s location and move in every direction until I either find a queen or reach the edge of the board.\n\nc
Queens can move in 8 directions, so I start at the king\'s location and move in every direction until I either find a queen or reach the edge of the board.\n```\nclass Solution(object):\n    def queensAttacktheKing(self, queens, king):\n        queens_dict = { (x,y): 1 for x,y in queens }\n        directions = [ [-1,0], [1,0], [0,-1], [0,1],\n                       [-1,-1], [1,1], [-1,1], [1,-1] ]\n        queens = []\n        for xd,yd in directions:\n            x,y = king\n            while 0 <= x < 8 and 0 <= y < 8:\n                x += xd\n                y += yd\n                if (x,y) in queens_dict:\n                    queens.append([x, y])\n                    break\n        return queens\n```
['Python']