Who will win?

Revision en1, by gXa, 2017-05-23 09:54:21

This is one of Interview Question.

You are given the string of a's and b's, eg. aaabbbaa and some threshold value t which indicates the threshold point, eg if count of a's or count of b's will become equal to t then whose count will be equal to t eg. a or b will win that match, and next game will continue further, eg from that index of a and b new count values will be incremented, and the process will continue, and at the last you have tell who won the match, a or b.

Expected time complexity: O( n*log(n)*log(n) ).

Tags dynamic programming, binary search, #interview

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English gXa 2017-05-23 09:54:21 553 Initial revision (published)