athenahealth interview question

Q: Leetcode medium difficulty, not too difficult