DEV Community

guang
guang

Posted on • Edited on

leetcode 19

it's hard for me. the annoying chatgpt give me a hint to use two pointer while i didn't asked and wanted when i asked another question. at first i have no clue even with the hint. but yesterday night when i go to bed i thought hardly and finally get the solution before i fell sleep. that's use two pointer to record the distance n between them! but i am not sure if without the annoying hint, can i solve it by myself.
in the solution the move faster pointer n times before move slower pointer. that seems more intuitive than mine: start both of the pointer from dummy head and count n than begin to move slower pointer.
i also learned from the author his way of thinking.

Top comments (0)