Dare2Compete coding challenge question. HELP???

Revision en1, by basantCoder, 2021-09-20 10:42:09

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: 5 1 2 0 6 10 OUTPUT: 1 1 0 2 2 Can anybody help??

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English basantCoder 2021-09-20 10:51:40 170 Tiny change: '\nExample:\n\nINPUT: \n\nFirst li' -> '\nExample:<br>\nINPUT: <br>\nFirst li'
en1 English basantCoder 2021-09-20 10:42:09 396 Initial revision (published)