ZS Associates Interview Question

LC easy and LC medium