Pergunta de entrevista da empresa Databricks

One of leetcode hard difficulty questions