Anonymous interview question

simple medium to medium hard dsa question