Barclays Interview Question

Josephus problem