Convert seconds to hh:mm:ss parts
Java
Hard
6 views
Problem Description
Task: given total seconds, return [hours, minutes, seconds].
Output Format
Return value
Constraints
Seconds >= 0.
Official Solution
static int[] toHMS(int sec){int h=sec/3600;sec%=3600;int m=sec/60;int s=sec%60;return new int[]{h,m,s};}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!