[Python] Check 8 steps in 8 Directions
Explanation\nStart from the position of king,\nwe try to find a queen in 8 directions.\nI didn\'t bother skipping the case where (i,j) = (0,0)\n\n\n## Complexit
## **Explanation**\nStart from the position of king,\nwe try to find a queen in 8 directions.\nI didn\'t bother skipping the case where `(i,j) = (0,0)`\n<br>\n\n## **Complexity**\nTime `O(1)`, Space `O(1)`\nas the size of chessboard is limited.\n\nFor the chessboard of `N * N`\nTime `O(queens + 8N)`\nSpace `O(queens)`\n<br>\n\n**Python:**\n```python\n    def queensAttacktheKing(self, queens, king):\n        res = []\n        queens = {(i, j) for i, j in queens}\n        for i in [-1, 0, 1]:\n            for j in [-1, 0, 1]:\n                for k in xrange(1, 8):\n                    x, y = king[0] + i * k, king[1] + j * k\n                    if (x, y) in queens:\n                        res.append([x, y])\n                        break\n        return res\n```\n
[]