• 1119

What will I learn?

In this puzzle, you have to manipulate large lists and use simple math concepts (e.g. min, max, average) to optimize the value of a variable.

External resources

Greedy algorithm

Learning Opportunities

This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.


Given a list of persons and their budgets, and the price of the present they wish to buy, you have to find the amount each person gives. You have to find this optimal distribution that minimize the highest contribution.

A higher resolution is required to access the IDE


The TARDIS time-and-space-ship lands on a strange planet. The local aliens, the Oods, want to make a present for a fellow Ood, but they can't seem a way to figure out how to manage everyone's budget. Help the Doctor find a system to decide the contribution of each Ood.


This exercise is the first presented for the challenge « Doctor Who ». If you like Doctor Who and want to try some harder puzzle, an other puzzle is available with Doctor Who, « Music Scores »

codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
Online Participants