SAP Interview Question

They tested me on a leetcode algorithm question