Lazy Array with Cached map and indexOf

Lazy Array

Implement a LazyArray class supporting:

  • map(fn): returns a new LazyArray and must return in O(1) without computing any element.
  • indexOf(target): returns the index of th...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: