Beginner Series #2 Clock 8 kyu: Codewars Solutions

Beginner Series #2 Clock

Clock shows h hours, m minutes and s seconds after midnight.

Your task is to write a function which returns the time since midnight in milliseconds.

Example:

h = 0
m = 1
s = 1

result = 61000

Input constraints:

  • 0 <= h <= 23
  • 0 <= m <= 59
  • 0 <= s <= 59

Solution

public class Clock
{
  public static int Past(int h, int m, int s) 
  {
    int result = (s*1000) + (m*60000) + (h*3600000);
    return result;
  }
}
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments