Poshmark interview question

Scripting - we need to write a logic for the given scenario