tag:blogger.com,1999:blog-2682781734368178743.post6908196596324574510..comments2023-03-28T14:19:44.264-07:00Comments on Technical Interview Questions, Answers, and Tips: Linked List: Find n-th element from the tailUnknownnoreply@blogger.comBlogger2125tag:blogger.com,1999:blog-2682781734368178743.post-66410395458512540652010-02-21T08:42:09.333-08:002010-02-21T08:42:09.333-08:00Hi ACR, I was assuming the last node to be the 0th...Hi ACR, I was assuming the last node to be the 0th node from back. But, if one assumes the last node to be treated as the 1st node from back then we would have to do what you suggested above. <br /><br />While looking at the code above I did notice that n is an int, so the code would always return the last node. We would have to do some special case handling, if n is negative, to either take the gmannoreply@blogger.comtag:blogger.com,1999:blog-2682781734368178743.post-71660120835768240792010-02-20T11:43:45.354-08:002010-02-20T11:43:45.354-08:00it should be return ptr2->next or while (ptr1 !...it should be return ptr2->next or while (ptr1 !=null)Ilker Acarhttps://www.blogger.com/profile/05280121720030292791noreply@blogger.com