Jio Interview Question

L2 - Couple of coding problems.