Charlie Health interview question

Medium hard coding question in LC