GithubHelp home page GithubHelp logo

koltra-challenge's Introduction

Gift Basket Challenge

Introduction

A packaging company is automating the packaging of gift baskets.

The gifts can come in one of five shapes: Square, Rectangle, Circle, Oval, and Triangle. They also have various weights from 50 grams to 250 grams in increments of 50g.

The packaging company receives a set of 7 random gifts from a gift company to arrange a basket. For example, the set may include:

150g Square, 250g Oval, 50g Rectangle, 100g Triangle, 50g Circle, 50g Circle, 200g Rectangle

The packaging company must assemble the best possible basket of 5 gifts based on a set of rules. See below for a list of rules that make optimal baskets.

Additionally, the packaging company uses different sets of rules for different seasons. See below for a list of rule sets.

Challenge Requirements

  • Write a program that takes a list of 7 gifts as input (The program can be written in the language of your choice)
  • The program output must indicate the the optimal set of 5 gifts to use for the basket (see below Optimal Basket Rules section)
  • The program must allow you to indicate the season (see below Rules Sets by Season section)
  • It is up to you to determine how data is input and output from this program (We will conform our tests to fit your input and output)
  • Your work must be pushed to GitHub to this repository within 2 hours from receiving this challenge.
    • Optional: you can make a separate branch for your code and create a PR instead of pushing directly to main

Evaluation

Your program will be evaluated on the following criteria ordered by importance:

  1. Development best practices
  2. Correctness
  3. Completeness

Optimal Basket Rules

A basket must always have 5 gifts. The following is a list of basket types ranked from most optimal to least optimal. When comparing two different baskets of the same type the one with the heaviest weight is considered better.

1: Perfect Variety:

Example: 50g Square, 100g Circle, 150g Rectangle, 200g Triangle, 250g Oval
Five gifts all with different weights and shapes.

2: Weight Variety:

Example: 50g Square, 100g Square, 150g Square, 200g Square, 250g Square
Five gifts with different weights of the same shape.

3: Shape Variety:

Example: 150g Square, 150g Circle, 150g Rectangle, 150g Triangle, 150g Oval
Five gifts with different shapes of all the same weight.

4: Perfect Pairing:

Example: 50g Square, 50g Square, 200g Circle, 200g Circle, 200g Circle
Three gifts of one shape and two of another. Each with consistent weights.

5: Shape Pairing:

Example: 150g Square, 50g Square, 50g Circle, 200g Circle, 200g Circle
Three gifts of one shape and two of another but with different weights.

6: Discount Basket:

Example: 150g Square, 50g Triangle, 50g Rectangle, 200g Circle, 200g Circle
A basket that doesn’t fall into the above categories.


Rule Sets by Season

Rule sets determine which set of rules should be used to determine the optimal basket. If a particular basket rule is not included in a season, you can assume that it is Discount Basket. For example, if the input for the rule set was Spring and a basket that would fall under Perfect Variety and a basket that would Perfect Pairing were passed in, the Perfect Pairing basket would be most optimal.

Spring
4: Perfect Pairing
5: Shape Pairing
6: Discount Basket

Summer
1: Perfect Variety
2: Weight Variety
3: Shape Variety
4: Perfect Pairing
5: Shape Pairing
6: Discount Basket

Autumn
1: Perfect Variety
2: Weight Variety
3: Shape Variety
6: Discount Basket

Winter
1: Perfect Variety
4: Perfect Pairing
6: Discount Basket

koltra-challenge's People

Contributors

victorl2 avatar

Watchers

 avatar

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.