7 kyu
Convert a linked list to a string
241 of 8,634donaldsebleung
Loading description...
Linked Lists
Recursion
Algorithms
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.
python new test frame work
Approved
I think that where you need to return null it would be better to just return null not null in string form.
nice ds practise kata
This comment has been hidden.
Please use markdown format tags to format your code, or it's quite unreadable and unusable, as explained there: https://docs.codewars.com/training/troubleshooting/#post-discourse
Your code crashes in sample tests too (third test), try to figure out why.
Updated JavaScript fork with
Node 14.x
.This fork updates the description for formatting and markup.
approved
COBOL translation.
Approved
good kata for learning data structures !
Great kata!
love this guy. Made my day.
This comment has been hidden.
This comment has been hidden.
Your code fails to account for the case of an empty linked list (i.e. when
list == null
).Here's a Factor translation. Thanks for the kata!
This comment has been hidden.
This comment has been hidden.
Hey, I passed all public testcases, but when i press 'attempt" btn, i get SIGSEGV. Maybe someone could help me, what is a reson for this error? So, check for the nullptr list is tested in public testcase.
thanks a lot
Please post your current solution here (and mark it as a spoiler) so I can review it and perhaps identify the problem, cheers :)
This comment has been hidden.
This comment has been hidden.
Thank you so much ) i passed this kata
This comment has been hidden.
This comment has been hidden.
donaldsebleung, thank you. I came up with a crappy solution, but at least it works.
I am pretty new to this. Working in JS.
I read about singly linked lists and tried to return some of the attributes, like length, head, node but I'm always getting "undefined" or an error. I would like to understand SLL, but whenever I use anything I read in the tutorials, I am basically hitting a brick wall here. Any tips? (I read the Wikipedia link and a few others)
Would you mind posting your code here (and marking it as a spoiler)? That way, I can potentially identify and locate the problem, cheers :)
This comment has been hidden.
Because you should
return
the result instead of printing it to the console.facepalm of course, sorry about that! problem soved, thank you.
I think you should make the Instruction more clear by saying the last element will be Null(in java) or null (in C) but you stated it like file system structure Null/null/NULL.
Another Important thing Stated clear that NULL will be in as a word not like "" or " ".
Thanks
Signal: Process exited prematurely with a SIGSEGV signal.
How should it be handled?
Perhaps you tried to access an array element using an out-of-range index or accessing a nonexistent property on an object? If you
#include <iostream>
on the top of your solution file and print out all the intermediate results to the console it could certainly help you identify the bug in your code, cheers :)bad thing is i do not see any debug from doing std::cout But the code is running and if i change it, i will receive what it expected isntead. But no result from std::cout
It seems to be nullptr as list. Try to check this If (!list) return "nullptr";
const Node*
would be a better argument type in C++.Is the instruction to print out a string representation of the form '0 -> 1 -> ... -> None' on a single line to be taken literally? That's what I've done, and though my output matches perfectly, it's being marked as wrong.
The instruction is to return the string representation, not print it.
Haskell translation added! Considering this is a 7kyu, I went the easy way and used built-in lists (which are already singly linked lists anyway).
Ruby translation
Please review and hopefully approve!
Java translation added!
This comment has been hidden.
Same with using the reserved word next.
Fixed
Hi, I made a C# translation for this Kata.
To all those who may want to translate my Kata,
Feel free to translate my Kata into any language you like! This Kata is not meant to be PHP-specific.
Cheers, donaldsebleung :D