Write the precise code to check the number is Odd or not.
Check the module 2 of number is Zero. If it Zero, number is Odd.
Problem: It will not return the correct result for the negative number.
If number is positive/negative, Subtract 2/-2 from number respectively until the number result is Zero or one.
Complexity of given approach is O(num).
Example: Number = 10
Binary representation of 10 = 1010
Binary representation of 1 = 0001
Logical AND of both numbers = 0000.
A number will be Odd iff last bit of binary representation is 1.
This is highly optimized code. Since, Arithmetic and Logical operations are much faster compared to division and multiplication.