HashedIn by Deloitte interview question

To Solve the 2 dsa questions