StackAdapt interview question

Walk through the code written.