Minimizing Xor With Least Significant Bits
Minimize Xor: Given two numbers, num1 and num2, find the minimum number that can be obtained by performing bitwise operations on num1 to match the bit count of num2.
Problem
TC : (n+m) where n and m are no. of bits in num1 and num2 respectively
/*
use cases
check if ith bit is set or not
toggle ith bit
count of bits in a number
*/
class Solution {
public int minimizeXor(int num1, int num2) {
int c1 = count(num1);
int c2 = count(num2);
int number = num1;
if(c1> c2){
int i = 0;
while(c1!=c2){
//keep on resetting the least significant bits from right to help till c1 == c2
//check if ith bit is set then unset it and decrement count
if((number & (1<<i)...