Upstox interview question

next smallest combination position from a given number.