Skip to content

Commit

Permalink
Time: 0 ms (100.00%), Space: 6 MB (16.51%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
Dipendra-Raghav committed Jun 7, 2023
1 parent 7263bb4 commit f99ebe6
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class Solution
{
public:
int minFlips(int a, int b, int c)
{
int d = 0;
while (a || b || c)
{
if (c & 1)
{
if ((a & 1) == 0 && (b & 1) == 0)
{
d++;
}
}
else
{
if (a & 1)
d++;
if (b & 1)
d++;
}
a >>= 1, b >>= 1, c >>= 1;
}
return d;
}
};

0 comments on commit f99ebe6

Please sign in to comment.