Dare2Compete coding challenge question. HELP???

Правка en2, от basantCoder, 2021-09-20 10:51:40

You start with 0 and you have to Find the minimum number of operations to reach 'n'. In one operation you can add or subtract any 2^k to your current number. Where k can be any positive integer.
Constraints:
test cases <200,000;
1 <= | n | <= 1,000,000,000 . Example:
INPUT:
First line is no. of test cases, then a single integer 'n' on each line.
5
1
2
0
6
10
OUTPUT:
1
1
0
2
2
Can anybody help??

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский basantCoder 2021-09-20 10:51:40 170 Tiny change: '\nExample:\n\nINPUT: \n\nFirst li' -> '\nExample:<br>\nINPUT: <br>\nFirst li'
en1 Английский basantCoder 2021-09-20 10:42:09 396 Initial revision (published)