Intresting question on binary number

Правка en2, от expertcoderhk, 2024-03-29 14:59:01

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 normal binary representation.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 so represent -9 in binary reprsentation How to approach this question.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский expertcoderhk 2024-03-29 14:59:01 77
en1 Английский expertcoderhk 2024-03-29 13:57:51 381 Initial revision (published)