Apple and Orange
This was the first HackerRank problem that I had to refactor specifically for performance. It kept timing out on the submission. I wish now I had committed earlier versions just so it would be easier to see the changes as I went through them.
Initially I had a list of every value between the house start and finish, and would compare every apple & orange fall coordinate value to see if it was in that list. That turned out to be very very slow, so I eventually got it to work by just checking if it fell within a range. In retrospect it’s pretty obvious.
HackerRank Link: http://ift.tt/2kiqLOc
February 11, 2017 at 02:42PM
via GitHub http://ift.tt/2l1zBEH