tag:blogger.com,1999:blog-8712770457197348465.post9188256331213833350..comments2024-03-28T02:47:19.159-07:00Comments on Javarevisited: How to find the 3rd (Kth) Node from end of linked list in Java? Fast and Slow Pointer Example [Solved] javin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-8712770457197348465.post-8455808562572125582021-12-04T10:55:45.378-08:002021-12-04T10:55:45.378-08:00size() - 3, it would always give 3 element from la...size() - 3, it would always give 3 element from last<br />SandeepSpurgeonhttps://www.blogger.com/profile/13647878952428847864noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-64350265709731868022019-06-08T21:01:26.065-07:002019-06-08T21:01:26.065-07:00This one is also O(n) No? both time and space comp...This one is also O(n) No? both time and space complexity is O(N) as this just uses two pointers no matter how many nodes are in the list.javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-13020406257681694702019-06-08T20:32:33.801-07:002019-06-08T20:32:33.801-07:00Easiest Solution in O(n)
https://youtu.be/cKqhgrPh...Easiest Solution in O(n)<br />https://youtu.be/cKqhgrPhZe4Anonymoushttps://www.blogger.com/profile/06110420871392106342noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-79302733408995866232016-08-24T21:51:01.241-07:002016-08-24T21:51:01.241-07:00I was asked how to find the 2nd element from the l...I was asked how to find the 2nd element from the last in a singly linked list in recent interview. Follow-up question was how do you detect the cycle on linked list i.e. where one of the node points to previous node in singly linked list. I was manage to answer both of them but stuck when they asked, how do you find the start of the cycle? Do you know how to solve this problem? Can the two Anonymousnoreply@blogger.com