GithubHelp home page GithubHelp logo

koldramke / santas-bag-org Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 7 KB

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

Java 100.00%
java list arraylist classes classes-and-objects

santas-bag-org's Introduction

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)]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.