Digital Control Interview Question

StairCase problem.