Persistent Systems interview question

Write code for sr levels.