PWC 366, Task 2, Valid Times
PWC 366 Task 2, Valid Times Here we are at another Weekly Challenge, ticking away the moments that make up a dull day. Fritter and waste the hours in an off-hand way. Kicking around on a piece of g...

Source: DEV Community
PWC 366 Task 2, Valid Times Here we are at another Weekly Challenge, ticking away the moments that make up a dull day. Fritter and waste the hours in an off-hand way. Kicking around on a piece of ground in your home town, waiting for someone or something to show you the way. Here's a way. The Requirements Phase You are given a time in the form ‘HH:MM’. The earliest possible time is ‘00:00’ and the latest possible time is ‘23:59’. In the string time, the digits represented by the ‘?’ symbol are unknown, and must be replaced with a digit from 0 to 9. Write a script to return the count of different ways we can make it a valid time. Example 1: Input: $time = "?2:34", Output: 3 02:34, 12:34, 22:34 Example 2: Input: $time = "?4:?0", Output: 12 Combinations of hours 04 and 14, with minutes 00, 10, 20, 30, 40, 50 Example 3: Input: $time = "??:??", Output: 1440 Example 4: Input: $time = "?3:45", Output: 3 03:45, 13:45, 23:45 Example 5: Input: $time = "2?:15", Output: 4 20:15, 21:15, 22:15, 23:1