Beta

tidying coloured bricks into boxes

Description:

Task:

There are several coloured blocks laying around, you are to tidy them away into boxes, each box can hold up to 10 coloured blocks, and there should be no more than 2 different coloured blocks in the same box.

you will be given a dictionary mapping the number of each coloured brick to its colour

Additional Info:

the number of different colours is not fixed, but is at least 1

the total number of coloured blocks is equal to the total storage available in the boxes

the number of boxes is equal to the number of colours that the blocks can be found in

Examples:

Given {"blue":4,"red":16}, your function should return something similar to:

[[("blue",4),("red",6)], [("red",10)]]

Given {"blue":4,"red":16,"green":7,"black":13}, your function could return:

[[("blue",4),("red",6)], [("red",10)], [("green",6),("black",4)], [("green",1),("black",9)]]

the number of each colour in a given box should be returned as a tuple

Stats:

CreatedJan 28, 2025
PublishedFeb 1, 2025
Warriors Trained21
Total Skips0
Total Code Submissions133
Total Times Completed10
Python Completions10
Total Stars3
% of votes with a positive feedback rating50% of 3
Total "Very Satisfied" Votes1
Total "Somewhat Satisfied" Votes1
Total "Not Satisfied" Votes1
Total Rank Assessments5
Average Assessed Rank
6 kyu
Highest Assessed Rank
4 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • Danworm Avatar
Ad