Frage im Vorstellungsgespräch bei Venus London Technology

An algorithm question from leetcode need me coding