Binary Length
Computer Mathematics
Easy
3 views
Problem Description
Given n>0, print how many bits are needed to write n in binary.
Input Format
One integer n.
Output Format
One integer bits.
Official Solution
Count how many times you can divide by 2 until 0, or find floor(log2(n))+1.
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!