expertcoderhk's blog

By expertcoderhk, history, 6 weeks ago, In English

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.

Full text and comments »

  • Vote: I like it
  • -15
  • Vote: I do not like it

By expertcoderhk, history, 7 months ago, In English

Given a List of coins, find minimum number of coins that need to be added to list so that all prices from [1,P] can be paid using the coins of list.

Constraints Length of coin list<=100000 Value of coins <=1000 P<=10000

Sample: P=19 Coinlist={1,4,10} solution=2

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it