[Python] Oneliner, explained
Let us do exactly what is asked in this problem: for each row: flip the image horizontally, then invert it. Quick way to get 0 from 1 and 1 from 0 is to use 1^q
Let us do exactly what is asked in this problem: for each row: flip the image horizontally, then invert it. Quick way to get `0` from `1` and `1` from `0` is to use `1^q` (however tests are so small, so difference is not very big).\n\n**Complexity**: time complexity is `O(mn)`, where `m`, `n` are sizes of image. Space complexity is also `O(mn)` if we count output and `O(1)` space if we do not count. Note, that if we allowed to modify original image, than we can have `O(1)` space.\n\n```\nclass Solution:\n    def flipAndInvertImage(self, A):\n        return [[1^q for q in row[::-1]] for row in A]\n```\n\nIf you have any questions, feel free to ask. If you like solution and explanations, please **Upvote!**
[]