NimbleRx interview question

Leetcode medium (on the easy side)