3 ms·
The “common” units are powers of 10 so this doesn’t work
by zeroonetwothree 3y ago
The “common” units are powers of 10 so this doesn’t work
- lifthrasiir 3y agoBut you can avoid binary search because there are at most one power of tens between 2^k and 2^(k+1). So you can turn it into a lookup table problem.
- morpheuskafka 3y agoThe original SO question did actually state they wanted powers of two (kilobyte as 1024 bytes). Although, they should have used KiB, GiB, instead to be pedantic.