Skip to the content

What time will it be?

Problem

It's 22 and you set an alarm for 5 hours from now. The clock never reaches 27: it wraps around and shows 3.

Write a function that takes the hour on the clock (0 to 23) and how many hours you have to wait (0 or more, it can be several days) and returns the hour it will show. If it lands on midnight, return 0.

Examples

  • 9, 2 → 11

  • Past midnight

    22, 5 → 3

  • Right on midnight

    23, 1 → 0

Besides these, the challenge has hidden tests that are revealed when you submit your solution.

You start with this

Python

def later_hour(hour, wait):
    pass

JavaScript

function laterHour(hour, wait) {
}
Solve this challenge

It opens in your browser, with the editor and the tests. It is free and you do not need an account to start.

More O(1) challenges

See all challenges →