Asurion interview question

javascript and typescript problem that is average in difficulty