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.
Because 0 is the item index, not the item itself.
Your code is failing these sample tests:
The collection is empty, so, there are no pages and no items, pageIndex should return -1 because there were no pages and pageItemCount from page 0 should also return -1 because it's an invalid page.
Your code also have problems with the previous tests, it fails to return 0 for item 3 with pageIndex method. Not a kata issue.
I don't think it's an issue:
It means it can be anything. Read the post below yours.
Read this: https://www.codewars.com/kata/529bf0e9bdf7657179000008/discuss#5e5d7cd837738b00289583e9 That's not the input of the test your code fails.
OP solved the task, closing
This kata helps force people to reevaluate how many passes their code does on the list in question. If you have nested loops, you'll likely hit timeouts for the lists with 10,000,000 elements, since even the fastest computers can't parse 10 million ^ 2 elements in a reasonable timeframe.
I suggest looking up "memoization" :)
you are possibly printing a lot. if so, silence the print statements and try again
This comment is hidden because it contains spoiler information about the solution
A bit of thought shortcut on my part, what I meant is that if you understand what this kata is about answer to your question is trivial, but without you stating what you know and what you don't, there's no way to tell what explanation you expect.
This comment is hidden because it contains spoiler information about the solution
Let's narrow it down, what part of the task exactly you don't understand?