Kevala Interview Question

leetcode style problem + design