Back
Close
  • 63

What will I practice?

Greedy algorithms

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

Statement

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

Story

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 »

Online Participants