Identify and fix deadlock in locked code | Box Interview Question