Your question is Clock Hands Rotation Degrees. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
A monitoring widget for Mastercard Decision Intelligence needs to report how far an analog clock's hour and minute hands have rotated from an initial time. Given the starting time and several elapsed-time queries, return the cumulative movement of both hands for every query.
The hour hand moves continuously at 0.5 degrees per minute, and the minute hand moves continuously at 6 degrees per minute. Movement is cumulative, so it is not reduced modulo 360; for example, a minute hand moving for 60 minutes travels 360 degrees.
Implement clock_hand_movement(start_hour, start_minute, elapsed_minutes), where start_hour and start_minute describe a valid 12-hour clock time, and elapsed_minutes is a list of nonnegative integer durations. Return a list of pairs. For each duration t, the pair [hour_degrees, minute_degrees] contains the degrees traveled by the hour and minute hands during the first t minutes after the starting time.
The starting time affects the displayed positions but does not affect the distance traveled, so all queries use the same constant hand rates.
def clock_hand_movement(start_hour, start_minute, elapsed_minutes):