Class Solution
java.lang.Object
g1301_1400.s1318_minimum_flips_to_make_a_or_b_equal_to_c.Solution
1318 - Minimum Flips to Make a OR b Equal to c.<p>Medium</p>
<p>Given 3 positives numbers <code>a</code>, <code>b</code> and <code>c</code>. Return the minimum flips required in some bits of <code>a</code> and <code>b</code> to make ( <code>a</code> OR <code>b</code> == <code>c</code> ). (bitwise OR operation).<br />
Flip operation consists of change <strong>any</strong> single bit 1 to 0 or change the bit 0 to 1 in their binary representation.</p>
<p><strong>Example 1:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2020/01/06/sample_3_1676.png" alt="" /></p>
<p><strong>Input:</strong> a = 2, b = 6, c = 5</p>
<p><strong>Output:</strong> 3</p>
<p><strong>Explanation:</strong> After flips a = 1 , b = 4 , c = 5 such that (<code>a</code> OR <code>b</code> == <code>c</code>)</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> a = 4, b = 2, c = 7</p>
<p><strong>Output:</strong> 1</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> a = 1, b = 2, c = 3</p>
<p><strong>Output:</strong> 0</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= a <= 10^9</code></li>
<li><code>1 <= b <= 10^9</code></li>
<li><code>1 <= c <= 10^9</code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
csb
public static int csb(int n) -
minFlips
public int minFlips(int a, int b, int c)
-