Gameskraft interview question

2 DSA ques in round 1