PharmEasy Interview Question

simple time complexity question based on while and for loops