← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Practice/Netflix/Timer Function
CodingMust
Implement a function that converts seconds into a human-readable time format showing months, weeks, days, hours, minutes, and seconds. This is similar to how Netflix might display content duration or time remaining.
The function must be implemented recursively and follow specific formatting rules.
Don't show zero units except for seconds
"5 minutes, 0 seconds""2 days, 3 minutes, 10 seconds""2 days, 0 hours, 3 minutes, 10 seconds"Always show seconds even if zero (except when larger units exist that equal exactly 0 seconds)
Use singular form for unit names regardless of count
"1 minutes" not "1 minute""3 hours" not "3 hour"Separate units with commas and spaces: "X units, Y units"
` timer(55)
timer(65)
timer(3805000)
timer(3600)
`