The Beacon-Watch of Karrowen Tor
High on Karrowen Tor stands the last beacon of the Greyhallow chain. When raiders are sighted in the passes below, its keepers light the great brazier and keep it burning until the warband rides past. The Wardens' Guild pays the keepers by the length of each burning, and the Guild's paymaster will accept a burn-length only when it is written in one exact form.
The keepers count each burning in whole minutes. Your contract is to turn that count into the form the paymaster demands.
Write formatBurn(minutes), where minutes is a non-negative integer giving the total length of one burning in minutes. Return a string of the form H:MM, where:
His the number of whole hours, written with no leading zeros and no upper limit. It may be0, and it may be more than 24.MMis the remaining minutes, from 0 to 59, always written as exactly two digits, with a leading zero when needed.- The two parts are joined by a single colon, with no spaces.
examples
- case 1
minutes of 135"2:15" - case 2
minutes of 5"0:05" (the minutes keep their leading zero) - case 3
minutes of 1500"25:00" (hours do not wrap past a day)
- reward
- 150 XP
- signature
formatBurn
TypeScript, run as ES2022 — types are stripped, not checked. If a JS engine would run it, so will we.
- zero minutes
- single-digit minutes padded
- just under an hour
- exactly one hour
- hours and minutes
- two-digit hours
- last minute of a day
- more than a day does not wrap
- padded minutes after many hours