Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
but the question says
Given the triangle of consecutive odd numbers:
and don't suggest on bulding one.would have been better if the format of the question is reformated or give clean picture on how to access the triangle
of numbers
sorry
And why are you posting this without marking it as a spoiler?
This comment is hidden because it contains spoiler information about the solution
Thank you, Flurin. I guess you've offered about as much help as possible. Yeah, I suppose helping with the math would maybe be too much. Looks like someone hid your last comment (wasn't me). I need all the help I can get. Thanks, again.
Description shows you exactly how the pyramid is constructed. And as it states, N is the row of pyramid that you have to return (as sum of its elements). You can either create the pyramid yourself, or look for some pattern that would help you calculate the sum in more mathematical way. Or simply, skip it for now :P
Do I have to create my own list/array of the values? I noticed the values (n) aren't the actual values in the pyramid. So, how do you work with something that doesn't exist? It's pretty easy if the values are there, but this doesn't explain how you get the values. It just acts like they're already there.
To give you a start, try to find a formula on how to calculate the sum of every number 0 to n. So for n = 10 it would be (1+2+3+4+5+6+7+8+9+10) = 55. You could calculat this with a for loop or you could come up with a formula.
This comment is hidden because it contains spoiler information about the solution
I just tried again, with a plain old simple for loop, where my 'sz' variable just increments based on the 'size', and it just dies. The system just cannot handle a for loop for the large numbers, so how are you doing the math? How do you come up with a math formula that does the same thing as a for-loop?
Right, you created this, Kata, didn't you? So, if we can count them, and we see the pattern and everything, how do we come up with the math to solve it? The problem is that an array doesn't work. It times out. So, how did you come up with the math to solve it? If I use math based on row-by-row, it would be like 7+1+6+3+5+2+7, so how did you use that example as a way to solve every problem, all the way up to 568 kazillion?
I solved it by looking at the amount of white cells in each row.
The real test cases (the ones that get executed when you press ATTEMPT) are much bigger than the example test cases (the ones you have passed). As you see in the error message, you had a stack overflow. If you dont know what that is, this might help: https://stackoverflow.com/questions/214741/what-is-a-stackoverflowerror. Also, I dont think this is an issue, it is a question.
Hi,
What mean the below error
My solution passed all test but after I tried ATTEMPT the below error dislpyed (stack overflow)
Time: 2317msErrors: 1Exit Code: 139
STDERR:
Stack overflow.
Thanks, Trumny. I'm not that smart, so I don't follow the logic there. It did give me the idea of focusing on the black squares, instead of the white squares, but I doubt that helps.
Yeah, I started using similar logic, where I just added the 'size' (N), and then just doubled ever other lower number, like 5 * 2, 3 * 2, and dropped them in an array or variable, but that doesn't work and times out. So, if you're showing me some way that involves straight math, I don't see it. I see you're showing me what looks like it might be some pattern, but I just don't see it. The only pattern I see is that one I mentioned before, where there are two sides for each of every other number lower than N/'size'.
So, this is really frustrating, because like I mentioned before, I can figure these all out multiple ways for all of the numbers below 500,000, but it's not until it goes over 500,000 that the patterns stop working.
Loading more items...