PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCareers
|Home/Coding & Algorithms/Scale AI

Compute clock hand angle with seconds and milliseconds

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of angular geometry and numeric precision in time-based systems, testing competency in parsing varying time formats and computing continuous clock-hand positions; it is in the Coding & Algorithms domain and requires both conceptual understanding of angular motion and practical application in precise computation. Interviewers commonly ask this problem to assess an applicant's ability to model continuous motion, handle 12/24-hour representations and edge cases, and manage seconds- and milliseconds-level precision when deriving and implementing numerical formulas.

  • medium
  • Scale AI
  • Coding & Algorithms
  • Software Engineer

Compute clock hand angle with seconds and milliseconds

Company: Scale AI

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given a time in the format `"HH:MM"`, representing a 24-hour clock time with hours and minutes. Extend this to potentially include seconds and milliseconds as follow-ups. 1. **Base problem** Given a string `time` in the format `"HH:MM"`, where: - `0 <= HH <= 23` - `0 <= MM <= 59` Compute the **smallest positive angle** (in degrees) between the hour hand and the minute hand on an analog clock that shows this time. The result can be a floating point number. 2. **Follow-up 1: Add seconds** Now suppose the input is `"HH:MM:SS"`, with: - `0 <= SS <= 59` Recompute the smallest angle between the hour and minute hands, taking seconds into account (the hour and minute hands move continuously, not in discrete jumps). 3. **Follow-up 2: Add milliseconds** Now suppose the input is `"HH:MM:SS.mmm"`, with: - `0 <= mmm <= 999` Recompute the smallest angle between the hour and minute hands, taking seconds and milliseconds into account. Specify the formulas you would use for the hand positions, how you handle 24-hour times on a 12-hour clock face, and then implement a function that returns the minimal angle between the two hands as a floating point value. Input: a time string in one of the above formats. Output: the smallest angle between the hour and minute hands, in degrees (a floating point number). Describe the algorithm and then implement it in your preferred programming language.

Quick Answer: This question evaluates understanding of angular geometry and numeric precision in time-based systems, testing competency in parsing varying time formats and computing continuous clock-hand positions; it is in the Coding & Algorithms domain and requires both conceptual understanding of angular motion and practical application in precise computation. Interviewers commonly ask this problem to assess an applicant's ability to model continuous motion, handle 12/24-hour representations and edge cases, and manage seconds- and milliseconds-level precision when deriving and implementing numerical formulas.

Related Interview Questions

  • Implement a Dependency-Aware Task Scheduler - Scale AI (easy)
  • Schedule Ready Tasks by Deadline - Scale AI (medium)
  • Implement a Task Processor - Scale AI (medium)
  • Update a Neuron Grid - Scale AI (medium)
  • Implement multi-head attention and LLM sampling - Scale AI (easy)
Scale AI logo
Scale AI
Dec 8, 2025, 6:15 PM
Software Engineer
Technical Screen
Coding & Algorithms
9
0

You are given a time in the format "HH:MM", representing a 24-hour clock time with hours and minutes. Extend this to potentially include seconds and milliseconds as follow-ups.

  1. Base problem
    Given a string time in the format "HH:MM" , where:
    • 0 <= HH <= 23
    • 0 <= MM <= 59
    Compute the smallest positive angle (in degrees) between the hour hand and the minute hand on an analog clock that shows this time. The result can be a floating point number.
  2. Follow-up 1: Add seconds
    Now suppose the input is "HH:MM:SS" , with:
    • 0 <= SS <= 59
    Recompute the smallest angle between the hour and minute hands, taking seconds into account (the hour and minute hands move continuously, not in discrete jumps).
  3. Follow-up 2: Add milliseconds
    Now suppose the input is "HH:MM:SS.mmm" , with:
    • 0 <= mmm <= 999
    Recompute the smallest angle between the hour and minute hands, taking seconds and milliseconds into account.

Specify the formulas you would use for the hand positions, how you handle 24-hour times on a 12-hour clock face, and then implement a function that returns the minimal angle between the two hands as a floating point value.

Input: a time string in one of the above formats. Output: the smallest angle between the hour and minute hands, in degrees (a floating point number).

Describe the algorithm and then implement it in your preferred programming language.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Scale AI•More Software Engineer•Scale AI Software Engineer•Scale AI Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • Careers
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.