Help — Problem Of an Interview

Revision en2, by go_rob, 2017-03-27 09:44:37

We are given the results of a tennis match between two players A and B as a string.

For eg- "ababbabaa", Here If the ith character is 'a' then it represents that the ith game is won by Player A.

A set is a positive integer. A set is won by a player if he wins (set value) games first. We have to find out all the possible valid sets that are possible for the string and output the outcome of the match (The one who wins more sets wins the match).

For eg — if Set size = 3 , ababb | abaa , Resuts in a draw.

If Set size = 2 , aba | bb | aba | a , Which is not a valid Match so set = 2 is not possible.

If Set Size = 6 |ababbabaa| , Won by Player A

Tags dynamic programming

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English go_rob 2017-03-27 12:00:10 70 (published)
en4 English go_rob 2017-03-27 11:56:14 53 Tiny change: 'ayer A\n\n[cut]\n\nMy Approach\n\n' -> 'ayer A\n\n'
en3 English go_rob 2017-03-27 09:51:29 24 Tiny change: 'ayer A\n\n' -> 'ayer A\n\n[cut]\n\nMy Approach\n\n'
en2 English go_rob 2017-03-27 09:44:37 69
en1 English go_rob 2017-03-27 09:41:29 660 Initial revision (saved to drafts)