Implement a Lazy Array
Company: Databricks
Role: Machine Learning Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
Quick Answer: This question evaluates understanding of lazy evaluation and deferred computation, implementation of iterator/generator-like abstractions, and the ability to compose functional transformations (map/filter) while managing performance and memory trade-offs.
Constraints
- 0 <= len(nums) <= 100000
- 0 <= len(operations) <= 10000
- -10^9 <= nums[i], x <= 10^9
- For `('take', k)`, 0 <= k <= 100000
- All operations are valid and appear in one of the supported forms