Skip to content

Fill Santa's bag from the heaviest present to a lighter present until achieve a limited weight.

Notifications You must be signed in to change notification settings

koldramke/santas-bag-org

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Santa's Bag Organization

This code is part of the "Tech Challenge Series – Advent Calendar 2021" advanced by Blip.pt (developed by Devskiller).

This year counting down to Christmas will be even funnier and Blip will be by your side the whole time with a variety of small programming puzzles and lots of prizes!

Task description

Santa is ready to distribute the presents for this Christmas, in a nearby town.

His bag can only carry a maximum of 50kg of presents so the reindeers don’t get tired during their journey (and because of Santa's back problem).

  • Presents come in blue, red, yellow and green wrapping paper.
  • Inside the bag the presents are stacked, from heavier to lighter.
  • There can't be adjacent presents with same color, to add more variety.

Find the best way to maximize the present weight following those conditions.

Example:

max = 50kg

presentWeights = [(5, red), (4, blue), (15, green), (14, yellow), (12, green), (2, blue), (6, red)]

solution = [(15, green), (14, yellow), (12, green), (6, red), (2, blue)]

About

Fill Santa's bag from the heaviest present to a lighter present until achieve a limited weight.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages