Bank BTPN Interview Question

Simple algorithm puzzle that should be coded live