Utility Function to convert N to its binary representation
def convertToBinary ( n ) : NEW_LINE INDENT ans = [ ] NEW_LINE while ( n ) : NEW_LINE INDENT rem = chr ( n % 2 + 48 ) NEW_LINE ans . append ( rem ) NEW_LINE n //= 2 NEW_LINE DEDENT ans = ans [ : : - 1 ] NEW_LINE return ans NEW_LINE DEDENT