Advent of Code is now back for a limited time only! Complete as many challenges as you can to earn those badges you may have missed in December. Learn more about how to participate here!
Start Free Trial

Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #52: Solving the Knapsack Problem

Ladarthure
14 - Magnetar
14 - Magnetar

my solution, struggled with optimization tool, but nice to use

danicahui
8 - Asteroid
Spoiler
Perhaps not the quickest solution, but ended up building a macro that selects the optimal combination of boxes 
Challenge 52 2020-07-29 macro.jpg

and tested it against every possible combination of 1, 2, 3 or 4 boxes
Challenge 52 2020-07-29.jpg

FlorianC
Alteryx
Alteryx

This is a perfect use-case for the optimisation tool!

 

Spoiler
WorkflowWorkflowMacroMacro
Florian Carrier
Strategic Solution Consultant
Alteryx
JethroChen
10 - Fireball
Spoiler
challenge_52_jc.PNG
JoePC
9 - Comet

Solution Attached

A2H
11 - Bolide
Spoiler
Capture d’écran, le 2020-10-29 à 00.44.28.pngCapture d’écran, le 2020-10-29 à 00.44.46.png
greggrimmer1
8 - Asteroid
Spoiler
Solved using the optimization tool - batched to run for multiple item count constraints.
Qiu
21 - Polaris
21 - Polaris

Difficult...

AkimasaKajitani
17 - Castor
17 - Castor

My solution.

 

I made 3 version.

1.Using Optimization tool

2.Using Iterative Macro

3.Using Location Optimizer Macro

 

I used the Location Optimizer macro for the first time at this challenge.

There was not much information, but the challenge gave me a clue to use.

 

Spoiler
AkimasaKajitani_0-1605966680948.png

 

mikeprice17
8 - Asteroid

Don't know a lot about optimization but my simple solution worked for this case but I don't think it would with larger more complex cases.