Help — Problem Of an Interview

Revision en5, by go_rob, 2017-03-27 12:00:10

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.

The Player who is first to win (set value e.g 1,2,3,4... ) games will win the set.

We have to find out all 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)