# searching medium

Last One In

The clubhouse door log records everyone who walked in, in order β€” and some kids came back several times. πŸšͺ

You get a list of names and a target. Print the position (from 0) of the LAST time the target walked in. The target appears at least once.

Example:

Input: names = ["leo", "mia", "leo", "kai", "leo", "mia"], target = "leo" Output: 4

"leo" appears at positions 0, 2, and 4. Scanning the whole list and overwriting the saved position each time leaves 4 β€” the last one.

πŸ’‘ need a hint?

srch-last-one-in.pyπŸ”’ given lines are locked β€” write your code in between
loading...