We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
seanlangbrown's example would always result in killtheworld even though the problem stated so.
We can prove by going through the first iteration the statement is incorrect:
- Before entering the function: score = 0, step = 1, energy = 0
- First if statement is skipped because step != N
- When way == 1, then score = 1, but energy = 0, so it goes straight to Killtheworld
- When way == 2, then energy = 0, but because energy is still 0, it goes to Killtheworld
Unless the statement is in regard to the testing samples, I don't believe this statement holds true for all scenarios.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Robot
You are viewing a single comment's thread. Return to all comments →
seanlangbrown's example would always result in killtheworld even though the problem stated so.
We can prove by going through the first iteration the statement is incorrect: - Before entering the function: score = 0, step = 1, energy = 0 - First if statement is skipped because step != N - When way == 1, then score = 1, but energy = 0, so it goes straight to Killtheworld - When way == 2, then energy = 0, but because energy is still 0, it goes to Killtheworld
Unless the statement is in regard to the testing samples, I don't believe this statement holds true for all scenarios.