Kikoff Interview Question

SQL using lag function and rank