NVIDIA Interview Question

Russian peasant algorithm in Python or pseudo