Chief Hopper Discussions | Algorithms | HackerRank
  • + 10 comments

    Its a simple problem. On each reaching height h bots energy is 2*botEnergy - h; irrespective of the gain or loss; so you can solve it from backwards initial energy to be zero; e=(e+h)/2 or (e+h)/2+1 depending on the value of e+h , here even and odd respectively.