Problem Brief
Get Next Image (For L4 :)
FULLTIMEONSITE INTERVIEW
Hallo - This question can't be practiced for now due to current limitations 🥹
You are to implement the getNext() function such that:
markedFavorites should be returned first.allImages that are not in markedFavorites.getNext() should return the next image in this combined sequence.Additional information collected through clarifying questions:
getNext() should return null.getNext() takes no parameters.markedFavorites[] is a subset of allImages[], and both vectors remain unchanged after construction.markedFavorites[] and allImages[] should be maintained.
Follow up: What if markedFavorites[] contains photos strictly in order the photos also are in allImages[]?
1Example 1
Input
allImages = ["i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8", "i9", "i10"], markedFavorites = ["i2", "i5", "i7"}
Output
"i2, i5, i7, i1, i3, i4, i6, i8, i9, i10"
Explanation
:)