Adobe Interview Question

DSA questions- medium difficulty