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.
Nice. Approved.
Applied both suggestions.
Thanks for taking this on.
I disagree about the
Vec
thing, but it's a minor issue and not that relevant. I have two more important notes:assert_eq
in Rust is given asleft == right
, which is OK if you can see tests and know which is what, but on Codewars the user has no idea what "left" and "right" refer to. An added clarification is mandatory for that reason (or useassert!
and roll your own).should equal result
or=> result
or something similar. At least change it for the Rust part.Notes:
PaginationHelper
should not be given in the initial solution, it's up to the user to decide what the structure of their type needs to be, since that is an implementation detail.new()
on the other hand needs a concrete signature. Don't make the user guess what arguments the tests are going to call it with.new
generic as well. "collection" covers more than simply vectors. The most useful thing here would probably beIntoIterator<Item=T>
, and let the user's implementation handle taking ownership of the values (maybe restrictT: Copy
).-1
is not an idiomatic return type for fallible operations in Rust. Any method that takes an argument that might be invalid should return anOption
. Indices and counts in Rust are typicallyusize
, so the return type ofpage_item_count
andpage_index
should beOption<usize>
todo!()
macro in them, not//todo
comments, otherwise they don't compile.I'm going to reject this. Feel free to fork it and apply necessary fixes.
This was until now one of the best katas I've seen. Learned a lot and had even more fun!
Using split(markers) with spread operator is really ingenious, respect!
I've tried to make the good proposal by josdem a little bit more Kotlin idiomatic and added a generator for testCases, so that we can check solutions against 200 randomly generated list of integers