0204

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(input) the available alternate leaving times that adds 20 minutes. Store it in a variable called alternateTimes20.
  • Find out(input) the available alternate leaving times that adds 45 minutes. Store it in a variable called alternateTimes45.
  • Compare minTime to each of both alternativeTimes20 and alternativeTimes45.
  • If alternateTime20 is earlier than minTime, move on to the next alternateTime.
  • If alternateTime45 is earlier than minTime, move on to the next alternateTime.
  • If alternateTime20 is equal or later than minTime, choose this time as an alternative.
  • If alternateTime45 is equal or later than minTime, choose this time as an alternative.

Next Post →

Leave a Reply

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