School Accuracy: 34.52% Submissions: 139 Points: 0
Write a program to print Binary representation of a given number N.
N = 2Output:
The binary representation of 2 is '10'
but we need to print in 30 bits so append
remaining 0's in the left.
N = 5Output:
The binary representation of 5 is '101'.
You don't need to read input or print anything. Your task is to complete the function getBinaryRep() which takes an Integer N as input parameter and returns a string of size 30 which is the binary representation of N.
Expected Time Complexity: O(LogN) Expected Auxiliary Space: O(1)