Intresting question on binary number

Revision en1, by expertcoderhk, 2024-03-29 13:57:51

Given a binary string of length<=100000, where even index means positive power of 2 and odd index means negative power of 2, find the value of string in decimal modulo 1e9+7.Assume rightmost index is least significant power.

For e.g If string s="1011" will be equal to (2^0)*1-(2^1)*1+(2^2)*0-(2^3)*1 = -9. How to approach this question.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English expertcoderhk 2024-03-29 14:59:01 77
en1 English expertcoderhk 2024-03-29 13:57:51 381 Initial revision (published)