Mujin interview question

technical interview - Medium leetcode question in C++