UKG Interview Question

Oops, DBMS, basic DSA, Puzzle