https://www.codingame.com/training/easy/container-terminal
Send your feedback or ask for help here!
Created by @java_coffee_cup,validated by @C2H5OH,@TBali and @LaurentValade.
If you have any issues, feel free to ping them.
https://www.codingame.com/training/easy/container-terminal
Send your feedback or ask for help here!
Created by @java_coffee_cup,validated by @C2H5OH,@TBali and @LaurentValade.
If you have any issues, feel free to ping them.
Hey guys ,
I know I need to take in the account the order in which the trucks are coming so sorting the string will not help . I figured that by comparing each value with the next one and stacking it if it`s a smaller value or starting a new stack if it is bigger would help but in cases like CBACBACBACBA I am stuck . Can you point me in a direction?
It can be done by comparing value of the incoming container with the current ātopā ones on the stacks like you said
CBACBACBA could be stacked
CBA
CBA
CBA
But it could also be stacked this way:
After first CBA
A
B
C
After second CBA
A
A
BB
CC
After third CBA
A
A
AB
BB
CCC
Yes , I figured that . What I meant was that I can`t figure out when to stack the smaller value or to wait because somewhere along the string is a better option. Like in the CBACBACAB test case the right answer is 3 ( I suppose they mean AAA BBB CCC).
But when I compare B with C , B is smaller so I could stack how should I know at that point that a C will come around .
You donāt have to know if C will come around. Look at my example above - B is stacked on C, but the final result would still be 3 stacks.
Hi guys! Frankly, I have difficulties understanding the part āIn the real world there is a maximum height limit for each stack of containers. In this puzzle we assume there is no such limit.ā. So what prevents me from, say, in the case of āCODINGAMEā to sort the containers alphabetically and putting them in one stack?
Containers are coming in like a stream. When one comes in, you have to immediately decide where to put it down. Once put down, it will not be moved again until it is time for loading to ships.
Finding an extra storage place for sorting and doing extra moving jobs are inefficient.
Ah, ok, thanks for the clarification!
Wow thanks I was focusing only on the [[CCC],[BBB],[AAA]] so I made it extremely complicated. Finally it was easy thanks to you !
Thatās supposed to be an easy puzzle, but I canāt figured out how iām supposed to do the last tests.
The first string which iām getting wrong is similar to that one (i removed a couple of useless letter in there)
JJBYHJRZ
Iām getting 5 columns :
JJJ, B, YH, R, Z
If i was to do it manually, i would not do much better : JJB, YH, J, R, Z
What am i missing here? ?_?
For a string JJBYHJRZ the answer would indeed be 5.
Which test exactly are you getting wrong?
Itās the ā¦ ooh, wait, thatās not where iām wrong, itās was the line before that one
Sorry !
On the third test how would MIWEWESTEWEMEMIMEW be split into only four stacks?
one of the possible solutions (each row is a stack):
[W, W]
[T, M]
[M, I, E, E, E, E, E, E]
[W, W, S, M, M, I]
Thank you!
I think Iām probably dumb because your hint seems to be helpful, but after staring at it for an hour, I still donāt understand the logic.
In other words: put it where it hurts the less.
Thanks you ! I was like Aathish, because I was reading your example lines by lines and not columns by columnsā¦
Nice explanation
Thanks a lot Yatech, youāve explained it perfectly now.