Your result

kody
Join Kody

Repair the cargo stack

Change activity
Last in, first out

Repair the cargo stack

Goal

Change [1, 9, 3, 8] into [1, 3, 3, 5] in at most 5 operations.

Preview board

Not run

Add instructions, then run your pseudocode.

Repair mission

1 edit available

Run or step through the broken pseudocode. Replace one line to reach the goal.

Pseudocode

0 / 5 instructions

    Ready to run.
    How it works
    Last in, first out

    Manipulate the top of a stack without treating it as an array.

    Key rule

    The top value is TOP. PUSH adds a value, POP removes TOP, DUPLICATE copies TOP, and SWAP exchanges the top two. Capacity is six.

    Worked example
    Different example: [2,5] becomes [2] after POP; PUSH(7) then gives [2,7]. Popping an empty stack is invalid.
    Win condition

    Complete the pseudocode and concept check.

    Show a hint

    Remove the obstructing top first. Bring unwanted values to TOP before removing them.

    Related modules
    Edit text

    Enter one instruction per line. You can use the displayed pseudocode or commands from the reference.

    Command reference

    WELCOME TO KODY

    A little play. A lot of possibility.

    I’m Kody, your coding companion. Your adventure is ready. Let’s find our way around.

    Log in