Tried to make an as convoluted as I possibly can "functional" solution in Java to this problem: https://twitter.com/Al_Grigor/status/1357028887209902088
I would not have made the 25 minute limit and fail to get the job, and on my way home would probably also beat myself up for not just using a damn for-loop.
Fun exercise none the less.