Barclays interview question

Josephus problem