Minimum Time Difference

Medium · Arrays & Hashing · Array · Math · String · Sorting

Problem

Given a list of 24-hour clock times in "HH:MM" format, return the smallest number of minutes between any two of them.

The clock wraps around: "23:59" and "00:00" are one minute apart, not 1,439. The same time listed twice is a difference of 0.

Examples

Input: timePoints = ["23:59","00:00"]
Output: 1

Going forward from 23:59, midnight is one minute away.

Input: timePoints = ["00:00","23:59","00:00"]
Output: 0

00:00 appears twice, and two equal times are zero minutes apart.

Constraints

Approaches

Related problems

Start free on Cariara · Coding problems · System design studio

Starting Python
No results yet.

          
↑↓ move ↵ open esc close

Labs

Loading labs…

Run with your own input

Starting Python

Loading Python…