Bloomberg interview question

2 leet code medium questions