Skip to content
bradendubois edited this page Nov 24, 2021 · 9 revisions

Stacking Cups

ID: cups

Difficulty: 1.7

CPU Time: 1 second

Memory: 1024 MB

Solution

For this, one can iterate through the cups given, and for every cup and size, store the pair in a mapping from size to color, and store the size in a list of sorts. If the first string is a digit, then divide it by two, and then store the color and value. After this, sort the sizes, and then iterate through the sorted list, outputting the corresponding color.

Clone this wiki locally