# stacks medium

The Coin Tube

Coins live in a spring-loaded tube β€” only the top one is reachable. Your lucky coin is in there somewhere. πŸͺ™

You get the tube's coins bottom to top and the lucky coin (appears exactly once). Print how many coins you must remove to have the lucky coin IN YOUR HAND (it counts too).

Example:

Input: tube = ["penny", "dime", "lucky", "nickel"], lucky = "lucky" Output: 2

Popping nickel first, then lucky itself β€” 2 coins removed to get the lucky coin in hand.

πŸ’‘ need a hint?

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