Ad
  • Custom User Avatar

    @Chrono79 Thanks again for the help and the great resource you linked. Recursion was happening however since I did not return the recursive function the value was being lost as the recursive stack frames unwind. This was solved by simply returning the recursive function or could have also been solved by using variables declared outside of the function that's state is changed by each recursive call.

    Thanks again for not giving me the answer but pointing me in the right direction.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    So how I understood it is. The h is anything greater than zero, window, where the mother is, value is changing and is greater than zero but less than h, and the ball is dropped from h.

  • Custom User Avatar

    @Chrono79, Thanks you were right. It was because I wasn’t validating all the inputs. I do not know what test case was causing the infinite loop but once I validated all the inputs it fixed the issue. My guess was there was a situation where window was less than 0 and my h value never goes below zero so it created an infinite loop.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution