JS simple solution O(n^2)
\nvar flipAndInvertImage = function(image) {\n    const output = [];\n    for (let i = 0; i < image.length; i++) {\n        output[i] = [...image[i]];\n        
```\nvar flipAndInvertImage = function(image) {\n    const output = [];\n    for (let i = 0; i < image.length; i++) {\n        output[i] = [...image[i]];\n        for (let j = 0; j < image[i].length; j++) {\n            output[i][j] = image[i][image[i].length - j - 1] ? 0 : 1;\n        }\n    }\n    return output;\n};\n```\n\n```\nvar flipAndInvertImage = function(image) {\n    for (let i = 0; i < image.length; i++) {\n        const row = [...image[i]];\n        for (let j = 0; j < image[i].length; j++) {\n            image[i][j] = row[image[i].length - j - 1] ? 0 : 1;\n        }\n    }\n    return image;\n};\n```
['JavaScript']