6 kyu
Row of the odd triangle
34 of 3,894shikyo
Loading description...
Algorithms
Performance
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.
Description should be language-agnostic
Can you help me?
I've got this message in output:
Fatal error in , line 0
Fatal JavaScript invalid size error 169220804
Your solution crashes for large numbers. Try running it with
n=160000
.Ok
In C++ datatypes which can handle bigger inputs required like double, long long
C#:
CollectionAssert.AreEqual
or any other predefined comparator function should be used instead of using the self / user-defined oneIn Java, the big random tests exceed the maximum value of long data type. If you use BigInteger to prevent this, you should get an error, because the return data type should be a long[].
and how did you solve this problem? the same bullshit
I think that providing argument type(unsigned int,c++, in fucntion prototype) that causes errors isn't a good idea.
In C#-test expected and actual are reversed
This has already been mentioned in an open issue
Clojure: solution is available for the user to submit
Clojure: no sample tests
C#: expected and actual are swapped in assertion.
COBOL translation (author inactive).
approved
good kata for beginner
Help please :). I am passing fixed tests but not random tests.
With small random tests, my values are 1 less than the expected value, every time I attempt.
With large random tests, my values usually are completely wrong. I am using ulong in most places in my code.
Any advice?
Do you know what values exactly make your solution fail? If not, you can get some hints here. When you know exact
n
, recreate the test case locally in your IDE and debug through it.Found my bug and solved it. Thanks! :)
random tests crash because of a conversion from int to long... I guess I'm doing it wrong ... ? Difficult to explain without spoiling
Test Results: Tests STDERR Execution Timed Out (16000 ms)
Your code is probably too slow. The description stated that your code should be optimized to handle big inputs already. Don't brute-force your way to do the calculations from 1.
I'm not brute forcing. The algorithm works fine on my machine. Can I send it to you?
Ok it works now. I guess I was using too much resources. Thx for the answer, good kata ;)
Julia translation
Approved
Alright, if doing your work in C++, absolutely take care what variable types you use, even in the function arguments. It seems like the row number variable can be extremely big, so the big test will fail if you use the wrong variable type!
C# translation. Please, review and approve.
Done
I am receiving an error when passing all the tests:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory Aborted (core dumped) Exit code 134
There doesn't seem to be much explanation at all on google Any suggestions?
Hi,
Not an issue, a question. ;) (the kata is working fine and as expected)
Your code is creating too much objects in memory => you'll have to work on that (check that you don't go in some cases in an infinite loop creating bigger and bigger arrays, for example)
Cheers
edit: not infinite loop related: just don't create the whole triangle: you'll get tests with arround 150000 levels
Thanks, realised my mistake, have solved it now :) Code was ok, but mathematics was lacking!
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
Not an issue. Your code for calculating
initial
is wrong.I think this is too easy for 6 kyu, feels more like a 7 kyu problem.
I agree - 7kyu would have been more appropriate
hard for me :(
This kata has performance requirements, that is the reason why it is 6 kyu.
how big are the Big_tests? i cant seem to get past that with c++
Please, C Translation Please, NASM Translation
C++:
Not very helpful feedback :/ Maybe show the first (and/or last) expected vector element?
Happened to me too. Nothing I've tried can fix this.
I can't quite recall what I did to solve it, but I think I fixed it by changing my variables to be of type
unsigned long long
.Added simple error messages for big tests.
( Haskell )
Solutions based on
genericTake
instead oftake
time out. Is the performance requirement intended to be that over the top?Nope, a linear approach should work. Lowered the input size, tell me if it's still timing out.
No longer times out. Still 10-12 seconds, but that's Haskell lists for you.
C++:
Should be fixed now.
Java translation. Please, review and approve (the author is inactive).
Reviewed and approved!
Haskell translation. Please, review and approve (the author is inactive).
C++ translation. Please, review and approve (the author is inactive).
Please see B1ts's suggestion above.
Ruby translation. Please, review and approve (the author is inactive).
JavaScript translation. Please, review and approve (the author is inactive).
Needs sample tests.
Done! I was sure I had put them in