FastPrepClock Hand Angle with Subsecond Precision
Problems/Clock Hand Angle with Subsecond Precision

Clock Hand Angle with Subsecond Precision

Scale AI logoScale AI● EasyFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Scale AI onsite interview. The report does not say the candidate's level or the exact format for fractions of a second. Our version covers the main task and the reported follow-up. It is about 97% the same as the reported question.

Given a valid time on a 12-hour analog clock, return the smaller angle in degrees between the hour hand and the minute hand.

The input time uses one of these forms:

  • HH:MM
  • HH:MM:SS
  • HH:MM:SS.mmm

Both hands move continuously. Seconds and milliseconds therefore affect both the minute-hand and hour-hand positions.

Function

smallerClockAngle(time: String) → double

Examples

Example 1

time = "03:45"return = 157.5

At 03:45, the minute hand is at 270 degrees and the hour hand is at 112.5 degrees. Their smaller separation is 157.5 degrees.

Example 2

time = "12:00:30"return = 2.75

After 30 seconds, the minute hand has moved 3 degrees and the hour hand has moved 0.25 degrees, so the smaller angle is 2.75 degrees.

Example 3

time = "06:00:00.500"return = 179.9541666667

Half a second after 06:00, both hands have moved continuously. Their smaller separation is approximately 179.9541666667 degrees.

Constraints

  • time is a valid zero-padded 12-hour clock time in one of the three documented formats.
  • 01 <= HH <= 12, 00 <= MM, SS <= 59, and 000 <= mmm <= 999.
  • Missing seconds or milliseconds are treated as 0.
  • Return a value in the closed range [0, 180]. Answers within 10^-6 of the correct value are accepted.

More Scale AI Onsite Interview questions

  • Task Scheduler with DependenciesONSITE INTERVIEW · Seen Jul 2026
  • Best Poker Category with a JokerPHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2026
  • Format and Validate a Model ResponseONSITE INTERVIEW · Seen Apr 2026
  • Stateful Neuron Matrix UpdateONSITE INTERVIEW · Seen Apr 2026
  • Four-Player Matching Card GameONSITE INTERVIEW · Seen Feb 2025
  • Rotate an Array to the RightONSITE INTERVIEW · Seen Oct 2024
  • Rich-Text Segment Normalization and Bold ToggleONSITE INTERVIEW · Seen Apr 2024
  • Minimum Distance Matching in a ForestPHONE SCREEN · ONSITE INTERVIEW · Seen Feb 2024
  • Shortest Distance Between Two NodesONSITE INTERVIEW · Seen Jan 2024
  • Fit Beta Parameters by Maximum LikelihoodONSITE INTERVIEW · Seen Sep 2022

Similar questions at other companies

  • Classify Natural-Month Distance Between DatesApple · ONSITE INTERVIEWApple interview questions
  • Transaction Fee Calculator — Channel Volume TiersStripe · PHONE SCREENStripe interview questions
  • Generate an Unbiased Bit from a Biased CoinGoogle · ONSITE INTERVIEWGoogle interview questions
  • Convert Hexadecimal to Dotted IPv4Microsoft · ONSITE INTERVIEWMicrosoft interview questions
  • Moving Cost by Volume and CategoryWayfair · ONSITE INTERVIEWWayfair interview questions
  • Most Cost-Effective MachineCapital One · ONSITE INTERVIEWCapital One interview questions
  • Recover the Initial Mango PileLSEG · ONSITE INTERVIEWLSEG interview questions
  • Estimate Pi from Sampled PointsJP Morgan Chase · ONSITE INTERVIEWJP Morgan Chase interview questions
  • Add Two Numeric Strings with CarryZipRecruiter · ONSITE INTERVIEWZipRecruiter interview questions
  • Three- and Five-liter Jug PlanXilinx · ONSITE INTERVIEWXilinx interview questions

Scale AI interview experiences

  • Scale AI OA: What It Tests (2026)
  • Scale AI Forward Deployed Engineer Debugging Round: 1 Experience
  • Scale AI ML Research Engineering Intern Interviews: 1 Experience
  • Scale AI SWE Intern Debugging Interview: 9 Experiences
  • Scale AI New Grad SWE and MLE Question Bank
  • Scale AI New Grad SWE Poker Screen and Onsite: 1 Experience
All Scale AI interview questionsSee Scale AI hiring insights
Saved
class Solution {
    public double smallerClockAngle(String time) {
        // Write your solution here
    }
}
Checking account…