Algorithm · Lyft · Hard
(This problem builds on LeetCode 158 – Read N Characters Given read4 II – Call Multiple Times. Solving that question first is recommended.) You work with a collection of read-only Stream instances. Every stream exposes a read(int n) method that returns at most n characters from whatever remains in that stream. When n exceeds the remaining characters, the call returns every leftover character. When the stream is exhausted, it returns an empty string "". For example, given…
Checking your access…