basic version
v1 works for naive cases
begin from head rather than dummy node
add comments for sol
sol of q147