08. Browser History Upgrade (Stacks & Queues - Lab)
Здрайвейте!
Опитвам се да реша осма задача от лекцията за стекове и опашки, но не мога да стигна до решение, по-добро от 50/100 в Judge.
Моля за насоки къде бъркам
Благодаря предварително!
Кодът ми: клик.
Условие:
8. Browser History Upgrade
Extend "Browser History" with a "forward" instruction which visits URLs that were navigated away from by "back". Each forward instruction visits the next most-recent such URL. If a normal navigation happens, all potential forward URLs are removed until a new back instruction is given If the forward instruction can’t be executed, print "no next URLs".
Hints
- Use the solution from Browser History
- Use ArrayDequeue<> as queue to keep the forward pages
- Use clear() method to reset the forward pages
- Use addFirst() when adding page to the forward pages
Examples
Input |
Output |
forward https//softuni.bg/ https//softuni.bg/trainings/courses back forward https//softuni.bg/trainings/2056 back forward forward https//softuni.bg/trainings/courses Home |
no next URLs https//softuni.bg/ https//softuni.bg/trainings/courses https//softuni.bg/ https//softuni.bg/trainings/courses https//softuni.bg/trainings/2056 https//softuni.bg/trainings/courses https//softuni.bg/trainings/2056 no next URLs https//softuni.bg/trainings/courses |
Благодаря! :)