Reddit interview question

A basic leetcode-easy style question. Absolutely nothing difficult whatsoever.