Retired

A good night's sleep (retired)

Description:

You have an important meeting tomorrow and need to make sure you receive 8 hours of sleep. Given the current time and the time that you want your alarm to go off as strings, create a function that tells us how long we can solve Katas before bed in hours as an integer, or return -1 if we are going to be tired and receive less than 8 hours sleep.

For example: You want to wake up at 7 am tomorrow. It is currently 6:30 pm. As we know you want to sleep for 8 hours and there is 12.5 hours till the alarm, you can solve kata for 4.5 hours and still wake up refreshed.

The input strings will always be of the form HH:MM for a 24 hour clock. They will only be given on factors of 5 minutes on the hour. e.g. "12:55" but never "12:26". e.g. "02:00" but never "2:00".

If the current time and the alarm time are the same, this means the time for the meeting is now. Why are you trying to sleep?! Go Go!

Good luck.

Fundamentals
Strings
Data Types

Stats:

CreatedApr 15, 2019
Warriors Trained45
Total Skips0
Total Code Submissions129
Total Times Completed15
JavaScript Completions15
Total Stars3
% of votes with a positive feedback rating40% of 10
Total "Very Satisfied" Votes3
Total "Somewhat Satisfied" Votes2
Total "Not Satisfied" Votes5
Total Rank Assessments11
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • bronteshammer Avatar
Ad