0203

Solution in English

  • Find out(input) how much did it delayed. Store it in a variable called delayedLength.
  • Find out(input) when can Mary leave. Store it in a variable called leaveTime.
  • Calculate leaveTime plus delayedLength. Store it in a variable called minTime.
  • Find out the available alternate leaving times. Store it in a variable called alternateTimes.
  • Compare minTime to each alternativeTime.
  • If alternateTime is earlier than minTime, move on to the next alternateTime.
  • If alternateTime is equal or later than minTime, choose this time as an alternative!

← Previous Post

Next Post →

1 Comment

  1. You’ve created an infinite loop that would crash your computer. 🙂 This is because there is no way to land if there is not a time in Courtenay.

    You want to find out what the current time is and add it to the remaining trip length (when she leaves is not important anymore). Then, compare to available times and if there is a time in Courtenay, land there, if not, land in Smit Field.

Leave a Reply

Your email address will not be published. Required fields are marked *