← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Design a class LazyArray that supports deferred mapping operations on an integer array. The class should allow chaining multiple transformations via a map() method, but the actual computation should only occur when indexOf() is called. Each map() call must return a new LazyArray instance without modifying the original. When indexOf() is invoked, apply the stored transformations in order to each element of the original array until the target value is found, then return its index; if not found, return -1. Implement short-circuit evaluation so that as soon as the target is located, no further elements or transformations are processed.