probable code correction
mchangir opened this issue · comments
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.