Genio interview question

Technical screen was leetcode-style question, about medium difficulty