Anduril interview question

Leetcode style question but not hard