lolapriego / coursework

Checklist of videos and exercises that you can follow if you want to get a good baseline for Data Structures and Algorithms.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

probable code correction

mchangir opened this issue · comments

visited.put(pos, visited.get(element + 1));

Shouldn't the above line instead be: visited.put(pos, visited.get(element) + 1);

Note the placement of the + 1
In your code it is the part of the visited.get() call, whereas I'm suggesting it should be outside the visited.get() call.
Please correct me if I'm mistaken. I'm just trying to make sense of the code.