Databricks interview question

Modified version of question listed under Databricks in Leetcode