Actyv interview question

2 DSA , 1 Mongo query