7 kyu
Find the K-th last element of a singly linked list
373 of 423SergiuB
Loading description...
Linked Lists
Lists
Data Structures
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Just out of curiosity, I see a lot of solutions where the individual nodes are stored in an array, returning the kth last entry of that array. Is this a generally acceptable way of doing this? Seems not to be in the 'spirit' of dealing with linked lists.
errrr... since when the element at "index 0" of a linked list is the last element of it...? :o
Aren't there any convention about this? I always remember the head as being equivalent to index 0 (cannot find quickly something meaningful on google, right now)
What does this have to do with the task?
@FArekkusu he's not asking of what the specs is, he's asking why the specs is that way.
This comment has been hidden.
This Kata, and the others in the linked list series, should be of a higher level, the point of these kata is very obscured, how to solve takes a bit deeper of knowledge then a lower level kata should require. At least, all of these should be in one of the yellow kata categories
Yes, it should be a 6 in my opinion too, but this is the average rating given by the beta solvers. This is basic CS stuff, so I guess people with CS background will rate it as easy.
PHP Translation Kumited - please accept :D
Done, thanks!
You're welcome :D
Needs some random tests ;-)
Added, thanks for the tip.
;-)