Databricks interview question

implement two methods for a lazy array