Meta Interview Question

Can you write a script to solve this problem