Dynamic Yield Interview Question

Architecture question, simple code task and talking about my experience