LeetCode: Flipping an Image Solution
Bit flip made easy with coercionApproach
For each row, reverse and flip bit
Bit flip made simple with coercion
11 - '1' = 021 - '0' = 1
Implementation
1var flipAndInvertImage = function (image) {2 return image.map(row => row.reverse().map(el => 1 - el))3}
References
Comments
Loading comments...
Tags
leetcode
array
string
Apply and earn a $2,500 bonus once you're hired on your first job!
Clients from the Fortune 500 to Silicon Valley startups
Choose your own rate, get paid on time
From hourly, part-time, to full-time positions
Flexible remote working environment
A lot of open JavaScript jobs!!
Fact corner: Referred talent are 5x more likely to pass the Toptal screening process than the average applicant.
Still hesitate? Read HoningJS author's guide on dealing with Toptal interview process.
Next Post
LeetCode: Ugly Number
Recursively dividing
Previous Post
CSSBattle 16.95: Pokeball
Multiple background images, gradient