Format the Runtime

Easy10–15 pts depending on language · +25 for learning a language that's new to you

A movie app prints how long a movie is like 2h 5m. Given the length in minutes, return the text exactly as it should be printed: the hours, h, a space, the leftover minutes, then m.

formatMinutes(125) returns 2h 5m.

You'll need integer division (/, or // in Python) for the hours and the remainder operator % for the minutes. In Python, turn numbers into text with str() before joining them to other text.

totalMinutes is between 0 and 10,000.

Examples

Input: formatMinutes(125)

Output: "2h 5m"

Input: formatMinutes(45)

Output: "0h 45m"

Your solution is checked against 2 example tests and 5 hidden tests (edge cases and bigger inputs).

Solved by 5 members

  1. 1Alex T.Rust · Oct 13
  2. 2brett B.Python 3 · Oct 14
  3. 3Isaac M.Python 3 · Oct 14
  4. 4CasonRust · Oct 20
  5. 5RainePython 3 · Oct 21
Full leaderboard →

Your Solution

Languages you don't learn in class are worth more: C++ 1.25×, JavaScript, TypeScript, C, Rust and Go 1.5×. Your first solve in a language unlocks its "Learned" achievement: +25 for learning it.

Loading editor...

IntelliSense: connecting…

Run Code checks the example tests. Submit runs every test, including hidden ones.