Kevala interview question

leetcode style problem + design