Open ShihTingJustin opened 3 years ago
var flipAndInvertImage = function(A) {
return A.map(i => i.reverse().map(i => i^1))
};
var flipAndInvertImage = function(A) {
const horizon = A.map(x => x.reverse())
const reverse = horizon.map(i => i.map(j => j = Number(!j)))
return reverse
};
悠哉的分步驟寫
var flipAndInvertImage = function(A) {
const reversedRows = A.map(row => row.reverse())
const filppedImages = reversedRows.map(row => {
return row.map(item => item === 0? 1: 0)
})
return filppedImages
};
暴力暴力~
用 map 寫成一行