6 kyu
Sum The Tree
2,218 of 4,847jz9000
Loading description...
Trees
Recursion
Binary Trees
Binary Search Trees
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.
solution_adsfhjkvasdfghjkdfhjsdaghjf
XDDDDDDDDDDDDDDDD
Scala translation
C#
Field names should be lower-case. This confused me utterly for a minute when the compiler complained about the fields not existing when I referred to them as such.What fields are you referring to?
member fields on the class. But nevermind, I opened up the style guide, and it turns out if a field is public, it should be capitalized.
Random tests still don't work for C++
( ͡° ͜ʖ ͡°) they work
Still not able to complete because of the Random tests in C++
Duplicate issue.
This kata is broken, after i unlocked solutions those still don't pass.
Which language?
edit: just tested all languages and they work fine, it must be problem with your code. You can post your code here and mark it as spoiler, then we'll be able to help you.
This is not a 6kyu problem. You're seriously high and/or disconnected from reality for asking this without giving any supplementary reading material for understanding trees
This comment has been hidden.
It's not clear if an empty tree is a valid input. That is, it's not specified, so I'd assume they are, but there are no empty trees in the original language (JS). JS and C# don't have empty tree tests, while C++ random tests do generate empty trees, so in either case some translations and maybe the description should be updated.
Removed the test with
nullptr
root, considering C, C#, and JavaScript do not have it.Language-specific code blocks are visible in all versions of the description.
Rust translation
Added to description
The random test doesn't work!
Everything is fine in C and JS. Maybe your code is wrong?
Bumping @l4cr0ss and @aruslan123; SIGSEGV on C++. Euphoric kata, wish I could get the credit.
Duplicate issue.
The random tests cause segmentation fault. I played around a little with the sample tests and it can be recreated by creating an uninitalized node. The test containing the uninitalized node will work but the test afterwards will cause a SIGSEGV signal.
Aside from that the kata is good.
Duplicate issue.
I got a "Process exited prematurely with a SIGSEGV signal.", anyone knows what is the reason?
The naming is ... bad. "SumTheThreeValues" - really? It's accumulate the tree, traverse the tree and return sum whatever. (c++)
Hi, I made a C# translation for this Kata, please consider approving it.
C++ gives error, used the same solution in C and it works.
worked for me in c++ on first try
This comment has been hidden.
That was a year ago- so it's probably irrelevant by now- but just in case- A little hint- what if left/right nodes got a left/right node of its own?
Very very easy compared to other C kata(s?) at 6 kyu. Fun though :)
C++ random tests are still SIGSEGV
Duplicate issue.
Segfaults should be gone, see gitter discussion.
C++ still segfaults for me. ("Process exited prematurally with a SIGSEGV signal.")
Since they're similar, I solved the C version instead.
C++ random tests SEG FAULT.
C++ random test segfaults, but maybe you can submit your answer as C. Solution should be similar and C test doesn't segfaults.
This comment has been hidden.
Removed test with
nullptr
root.didn't apply my solution because of segmentation fault. but when I'm opened the other solutions it has the same as mine logic.
Yep, there is a segmentation fault at the end (in the random test). :(
C-Translation kumited.
need some random tests
This comment has been hidden.
The random test is broken, it segfaults.
I noticed there weren't a lot of tree problems in the easier kyu levels so I made a simple problem that would make for a (hopefully) good introduction to solving tree problems. I based my code and examples around this exellent problem: https://www.codewars.com/kata/binary-tree-compare
This is my first attempt at a Kata, thanks for your patience.