C3 AI interview question

Leetcode medium/hard, plus some behaviorals.