# stacks medium

The Maze Backtracker

Explorers drop a breadcrumb at every step β€” back means eat the last breadcrumb and retreat. 🍞

You get moves β€” direction words (like north) or back (never past the start). Print the trail of moves still standing, comma-separated, or back at start.

Example:

Input: moves = ["north", "east", "back", "south"] Output: north,south

north and east get pushed as breadcrumbs. back pops east off, retreating one step. Then south gets pushed β€” leaving north,south.

πŸ’‘ need a hint?

stk-maze-backtracker.pyπŸ”’ given lines are locked β€” write your code in between
loading...