Bank BTPN interview question

Simple algorithm puzzle that should be coded live