Hacker News new | past | comments | ask | show | jobs | submit login

Consider this kind of cycle:

  Head -> Node1 -> Node2 -> Node3
            ^                 |
            +-----------------+
If it's a circular list then your option would work, but not all cycles will produce circular lists.



Thanks. This seems so obvious now! Always draw it out I guess.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: