Meeting room free hours
Your task
A meeting room packs one day of its calendar into a single integer. Bit h of that word, counting the least significant bit as bit 0, is set when hour h is already booked, and the hours of a day run from 0 to 23. Bits 24 and above carry unrelated housekeeping and must be ignored, even when they are set. busy_masks holds one word per day. Return one entry per day, in the order the days are given, holding the earliest hour at which a free block of hours_needed consecutive hours starts. The whole block has to sit inside the day, so it ends at hour 23 or earlier. Return -1 for a day with no such block, which covers every day when hours_needed is more than 24. hours_needed is never negative, and 0 means nothing to book, so every day answers 0.
Examples
earliest_free_hour(busy_masks: list[int], hours_needed: int) -> list[int]Example 1
Input
earliest_free_hour([511, 0], 3)Output
[9, 0]Example 2
Input
earliest_free_hour([16777215], 1)Output
[-1]Example 3
Input
earliest_free_hour([12, 0, 4095], 5)Output
[4, 0, 12]