PMG Digital Company Interview Question

Please explain your code from the OA