SAP Interview Question

An algorithm code challenge