Google | Phone Screen | Zombies vs. Humans
Anonymous User
1774

There are m zombies and n humans at war with each other. Each army has a kill ratio which determines how many of each army will die in each round. After each human dies, it becomes a zombie and after each zombie dies - it just dies. Find the number of rounds it would take for an army to win and also return which army won.

Eg:
m = 10
n = 10
killRatioZ = 0.2 (i.e., zombies can kill 2 humans in each round)
killRatioH = 0.3 (i.e., humans can kill 3 zombies in each round)

return the number of rounds. Obviously the zombies will win here.
The value for kill ratios will be always 0.0 < ratio < 1.0

Comments (9)