I just wonder why the output of "DRRDRDRDRDDRDRDR" is R?
As my understanding, the sequence processing (each senator comes in) as:
D, D, R, D, R, D, R, D, R, D, DD, DD, DDD, DDD, DDDD, DDDD? where am i wrong. Thanks.
You can always ban the closest senator from other party after you (to prevent him banning your teamates), so the sequence should be, "D
RR DR DR DR DD RD RD R", "D RRRR D D D", " D RRR", mind that in the last run, the second R is banned by the first D, who is then banned by the third R.
Other orders may also be acceptable, so long as there are enemies, you ban him.
Correct me if I am wrong, and also, I do not understand your sequence processing order.
Had the same thought process, and indeed, you can ban any other senator of your choosing, but the problem specifies that every senator will make the best decision, and voting someone that hasn't voted yet is a better choice than one who has already voted.
This is why in this case, the second R senator will eliminate the next D senator, rather than banning the first D senator. as it will change the game around and make the Radiant team win.
@dan_chow Thank u very much! I considered wise actions as always ban first person of another party to make persons in own party has high rank in next round...lol
What about the case DRRD.
D blocks first R
so we had D
Then R should block first D to get
With this R wins now not D.
@JustDoIt Sorry, but the first run has not finished yet, the last D can block the second R and so only the last D survived the first run. Actually, it makes no difference which D to block in the first run, except that if it blocked the second D, it will survive until the second run.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.