Altimetrik interview question

Coding, related to cypress question