Company: Rapidue
Difficulty: medium
31. Alternating Bits Coding UNSOLVED Given a positive integer, your task here is to check whether it has alternating bits in its binary representation. Alternating bits are when two adjacent bits will always have different values. Print "true" if the integer has alternating bits else print "false" . Input Format Single line containing an integer N Constraints 1 ≤ N ≤ 50 Output Format Print "true" if the integer has alternating bits else print "false" Examples Sample Input 1 10 Sample Output 1 true Sample Input 2 15 Sample Output 2 false Explanation The binary representation of 10 is: 1010 The binary representation of 15 is: 1111 Execution time limit 4 seconds