Frontend test solution asked in one of the interview