In this lesson, you’ll go over the code for the recursive solution to the Santa Claus problem from the first lesson:
def deliver_presents_recursively(houses):
if len(houses) == 1:
print("Delivering presents to", houses[0])
else:
mid = len(houses) // 2
first_half = houses[:mid]
second_half = houses[mid:]
# first elf
deliver_presents_recursively(first_half)
# second elf
deliver_presents_recursively(second_half)