SAP Interview Question

A small coding round from leetcode question