Databricks Interview Question

implement two methods for a lazy array