Goldman Sachs Interview Question

they asked some leetcode questions on hackerrank