Skip to content

#1318 - Minimum Flips to Make a OR b Equal to c

MediumBit Manipulation
Open on LeetCode

Given three positive integers a, b, and c, return the minimum number of bit flips required so that a OR b === c. A flip changes a single bit from 0 to 1 or 1 to 0 in either a or b.

InputOutput
a = 2, b = 6, c = 53
a = 4, b = 2, c = 71
a = 1, b = 2, c = 30

Released under the MIT License.