Back to SpaceX questions
CodingStarlink - Mixed or Unclear Role

Clock-Hand Angle in C

Role: Starlink - Mixed or Unclear Role

Frequency: Reported


Write a C program that computes the angle between the hands of a clock.

The reported implementation discussion included:

  • compute the minute-hand angle as minute * 6;
  • store hours and minutes in same-length uint8_t arrays and iterate through five test cases;
  • allocate each result dynamically with malloc and return a pointer;
  • print inputs and results with formats including %d and %.2f, correcting a mismatched format for double;
  • releasing allocated memory with free; and
  • compute the absolute angle difference manually, without <math.h>, using a conditional to keep it positive.

The source did not preserve complete code or whether to return the smaller of the two possible angles.

Context (from the same community report)

Channel context from a SpaceX intern: the intern technical is drawn from a question bank, but questions differ org to org — teams "like to give more practical problems that resemble the type of work you'd be more likely to encounter on that team," and all interns on sister teams received the same technical. Leaked problems are retired ("vaulted") from the bank; the reporting intern's own problem, which was about freezers, was vaulted after it leaked.

Source: community report, April 2026