diff --git a/leetcode/src/190.c b/leetcode/src/190.c index 0fc3306f6..19e15f79f 100644 --- a/leetcode/src/190.c +++ b/leetcode/src/190.c @@ -5,12 +5,12 @@ uint32_t reverseBits(uint32_t n) uint i; for (i = 0; i < TotalBits; i++) { - if ((n & - (UINT32_C(1) - << i))) // if the bit on the ith position of 32 bit input is 1, - // then proceed Further note the use of UINT32_C to convert - // 1 to unsigned 32 bit int, since just 1 is treated as int - // which cannot be shifted left more than 30 times + if ((n & (UINT32_C(1) + << i))) // if the bit on the ith position of 32 bit input is + // 1, then proceed Further note the use of UINT32_C to + // convert 1 to unsigned 32 bit int, since just 1 is + // treated as int which cannot be shifted left more + // than 30 times reverse_int = reverse_int | (UINT32_C(1) diff --git a/leetcode/src/191.c b/leetcode/src/191.c index b3c6c69de..169676da4 100644 --- a/leetcode/src/191.c +++ b/leetcode/src/191.c @@ -4,11 +4,12 @@ int hammingWeight(uint32_t n) int i, weight = 0; for (i = 0; i < TotalBits; i++) { - if (n & (UINT32_C(1) - << i)) // if the bit on the ith position of 32 bit input is 1, - // then proceed Further note the use of UINT32_C to - // convert 1 to unsigned 32 bit int, as just 1 is treated - // as int which cannot be shifted left more than 30 times + if (n & + (UINT32_C(1) + << i)) // if the bit on the ith position of 32 bit input is 1, + // then proceed Further note the use of UINT32_C to + // convert 1 to unsigned 32 bit int, as just 1 is treated + // as int which cannot be shifted left more than 30 times weight += 1; } return weight; diff --git a/leetcode/src/476.c b/leetcode/src/476.c index 73a951d7e..5a5825f9c 100644 --- a/leetcode/src/476.c +++ b/leetcode/src/476.c @@ -7,7 +7,7 @@ int findComplement(int num) // standard size in memory, we cannot rely on size for that information. TotalBits++; // increment TotalBits till temp becomes 0 temp >>= 1; // shift temp right by 1 bit every iteration; temp loses 1 - // bit to underflow every iteration till it becomes 0 + // bit to underflow every iteration till it becomes 0 } int i, flipNumber =