Avaya interview question

series related codeing problem