Digital Control interview question

StairCase problem.