Ramp interview question

The live coding interview is roughly a Leetcode Hard level problem