Goldman Sachs Interview Question

2 hard level DSA questions