bitwise-operators-in-c-hackerrank
bitwise-operators-in-c-hackerrank
Objective
This challenge will let you learn about bitwise operators in C.
Inside the CPU, mathematical operations like addition, subtraction, multiplication and division are done in
bit-level. To perform bit-level operations in C programming, bitwise operators are used which are
explained below.
Bitwise AND operator & The output of bitwise AND is 1 if the corresponding bits of two operands is 1.
If either bit of an operand is 0, the result of corresponding bit is evaluated to 0. It is denoted by &.
Bitwise OR operator | The output of bitwise OR is 1 if at least one corresponding bit of two operands
is 1. It is denoted by |.
Bitwise XOR (exclusive OR) operator ^ The result of bitwise XOR operator is 1 if the corresponding
bits of two operands are opposite. It is denoted by .
Task
Given set , find:
the maximum value of which is less than a given integer , where and (where ) are two
integers from set .
the maximum value of which is less than a given integer , where and (where ) are two
integers from set .
the maximum value of which is less than a given integer , where and (where ) are
two integers from set .
Input Format
Constraints
Output Format
Sample Input 0
54
Sample Output 0
2
3
3
Explanation 0
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.