FastPrepMinimum Difference Between Two Clock Times
Problems/Minimum Difference Between Two Clock Times

Minimum Difference Between Two Clock Times

Micron Technology logoMicron Technology● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Micron Technology phone screen. The task gives two clock strings. We chose the clean-up of the format, the answer in minutes, and reading the day as a circle. Our version is about 82% the same as the reported question.

Each input is a lowercase 12-hour clock time in the form h:mmam or h:mmpm. Return the smaller number of minutes separating the two readings on a 24-hour clock.

Function

minimumTimeDifference(first: String, second: String) → int

Examples

Example 1

first = "11:30pm"second = "3:00pm"return = 510

The same-day separation is eight hours and thirty minutes.

Example 2

first = "11:50pm"second = "12:10am"return = 20

The shorter separation crosses midnight.

Constraints

  • Both inputs are valid normalized 12-hour times.

Source note: Author-written prompt excerpt retained for source fidelity.

Similar questions at other companies

  • Subtract Two Large Number StringsStackAdapt · PHONE SCREENStackAdapt interview questions
  • Transaction Fee Calculator — Parts 1–2: Basic Fee Calculation and Conditional Fee RulesStripe · PHONE SCREENStripe interview questions
  • Fair Coin from a Biased CoinAnthropic · PHONE SCREENAnthropic interview questions
  • Stack Formula InterpreterTypeSafe AI · PHONE SCREEN
  • Roman to IntegerKotak Mahindra Bank · PHONE SCREEN · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Decimal Digits in OrderZoomInfo · PHONE SCREEN
  • Add Two Integers Given as StringsJane Street · PHONE SCREENJane Street interview questions
  • Fizz and Buzz Words From 1 to nDocuSign · PHONE SCREENDocuSign interview questions
  • Integer to String Without Built-insHudson River Trading · PHONE SCREENHudson River Trading interview questions
  • Excel Sheet Column TitleUiPath · PHONE SCREEN
See Micron Technology hiring insights
Saved
class Solution {
    public int minimumTimeDifference(String first, String second) {
        // Write your code here.
    }
}
Checking account…