Seconds to HH:MM:SS
Given a non-negative integer total_seconds, convert it to an exact HH:MM:SS string. Hours, minutes, and seconds must each contain exactly two digits. The…
Given a non-negative integer `total_seconds`, convert it to an exact `HH:MM:SS` string. Hours, minutes, and seconds must each contain exactly two digits. The valid domain is limited to 99:59:59.
- `0 <= total_seconds <= 359999` - Return exactly eight characters in `HH:MM:SS` format.
Example 1: input total_seconds = 3661; output "01:01:01". 3661 seconds contain one hour, one minute, and one second.
Example 2: input total_seconds = 59; output "00:00:59". No complete minute or hour is present.
Category: Math & Numbers. Topic: math. Difficulty: Easy. Patterns: math.