Amazon Online Assessment 2021 (OA) - Recent Items
A company aims to enhance how the 'Recently Viewed Items' page operates; they're introducing novel features to make it more user-friendly. One of the key changes is to rearrange the positioning of items based on their usage; if a previously viewed item is accessed again, it will be shifted to the foremost position but without disturbing the order of the rest. In the case of first-time viewings, the novel item will be directly added to the prime position.
They are starting with an unpopulated 'Recently Viewed Items' page and adopting a systematic approach. When given a list of accessed items, their aim is to show, from prime to least, the final order of items on the page.
Relevant Amazon OA Problems:
logs = ['Echo Show 8', 'Kindle Oasis', 'Fire TV Stick', 'Echo Show 8']
['Echo Show 8', 'Fire TV Stick', 'Kindle Oasis']
1<=n<=10^5- The length of an item's name does not exceed 10.
- Item names are alphanumeric.