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.
Like the others have said before, is the solution good mathematical work. But in programming bad practice. For small n you can use it, but for greater n it would screem for a stack overflow.
The reason is that you call in each return the function nthfib for two times, which will be saved in the memory till you reach 1. At this point it bubbles back and return the addition from the retun statements.
This mess up the memory and crash your system.
An other solution, like mine, is the linear one where you loop up. With the use of one temporary int I can calculate the n-th fibonacci. The memory it´s also constant, in the inner loop you use constantly three int with each 4 Byte = 12 Byte. This isn´t much.
Now I understand the problem, I didn´t noticed that the number string grows like [1,2,3,...,inf].
Okay, this seems manageable...
I have a few ideas... Thanks for your request and help!
Okay...so far so good...
But from where I get a new string?
This method is given in c#
public static long findPosition(string str)
{
}
The parameter is a string, not infinit.
In the first test case I should find "456" in "...3456...".
With IndexOf I get 4 for "456", but 3 expect...Why?
"...3456..." as parameter is a fixed string, not an infinit string...
In the next testcase for the given string "...444546..." it should return position 79.
79 for a string with a Length of 12??
This makes no sense in C#...What have I missunderstood?
Greetings
Noha
Good Morning!
Can anyone please explain the main problem?
If I would find an index of a subsequence in a string I would use indexOf in C#.
At the second case he said that I can create my own string if I can´t find this subsequence...Okay, the subsequence I searchd is at the first position, cause I created a string on my own.
Seems I don´t understand the problem...
Greetings
Noha
hello ciprian...
okay, as a sum of the input it make sense.
Before I interpreted the input numbers as the percentages, weich was correct for the Test Cases in the Test Phase, but not for the further Tests in the Attempt Tests.
But it should be clear in the description that the input is not the percentage value. it can be missinterpreted.
Seems a bit buggy in C#...
For example All3s give {0, 0, 11, 0, 0, 0}, but expect 100% for 11.
RandomBigExamples is also different {198, 176, 175, 155, 144, 152}, but expects 15%,14%,15%,17%,17%,19%}. It cuts the last digit of each percentage.
RandomSmallSampleSize makes another approach too. {5, 0, 2, 1, 0, 2} should be interpreted as {2%,"\n",1%,2%,"\n",5%}, but it expect {20%,"\n",10%,20%,"\n",50%}.
This make no sense...