Tap here to switch tabs
Problem
Submissions

Problem: Number of Elapsed Seconds Between Two Times

Number of Elapsed Seconds Between Two Times gives two valid same-day times as strings and asks for the elapsed time between them in seconds, from the earlier time to the later one.

Statement

You are given two strings startTime and endTime representing two valid timestamps on the same day in the format "HH:MM:SS".

Return the total number of elapsed seconds from startTime to endTime.

Constraints:

  • startTime.length =8= 8

  • endTime.length =8= 8

  • startTime and endTime are valid times in the format "HH:MM:SS"

  • 00≤extHH≤2300 \leq ext{HH} \leq 23

  • 00≤extMM≤5900 \leq ext{MM} \leq 59

  • 00≤extSS≤5900 \leq ext{SS} \leq 59

  • endTime is not earlier than startTime

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Elapsed Seconds Between Two Times

Number of Elapsed Seconds Between Two Times gives two valid same-day times as strings and asks for the elapsed time between them in seconds, from the earlier time to the later one.

Statement

You are given two strings startTime and endTime representing two valid timestamps on the same day in the format "HH:MM:SS".

Return the total number of elapsed seconds from startTime to endTime.

Constraints:

  • startTime.length =8= 8

  • endTime.length =8= 8

  • startTime and endTime are valid times in the format "HH:MM:SS"

  • 00≤extHH≤2300 \leq ext{HH} \leq 23

  • 00≤extMM≤5900 \leq ext{MM} \leq 59

  • 00≤extSS≤5900 \leq ext{SS} \leq 59

  • endTime is not earlier than startTime