+ 2

Challange :identify the minimum number of bits required to represent a number?

ex: input:5 output :3 input 4 output:3

22nd Aug 2017, 11:29 AM
Pavuluri Gopikrishna
Pavuluri Gopikrishna - avatar
4 Réponses
22nd Aug 2017, 11:48 AM
Maz
Maz - avatar
+ 10
JavaScript: alert((prompt("") - 0).toString(2).length);
22nd Aug 2017, 2:46 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
24th Aug 2017, 4:01 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
And Python: print(int(input()).bit_length()) :^)
22nd Aug 2017, 4:00 PM
Edgar Garrido
Edgar Garrido - avatar