loading...

re: Algorithms Problem Solving: Reduce to zero VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Sounds like a similar problem on leetcode: leetcode.com/problems/counting-bits/ I don't see how this helps though, am I missing something? 8 requ...
 

Hey imagine this solution as travelling a series if bits where travelling has a cost, for example travelling from 0 to 1 and 0 to 0 will cost you "1" and travelling from 1 to 1 will cost you "2" and travelling from 1 to 0 will also cost you "2" and if the last bit is 1 then add "1"
So 10110 will cost you 7.

Ah ok, very cool! Thanks for explaining!

Code of Conduct Report abuse