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.
This comment is hidden because it contains spoiler information about the solution
modulo operation was expensive isn't it? it can be done without using module operation at all..
This comment is hidden because it contains spoiler information about the solution
建议检查下长度
if str2.matches('0').count() == str2.len() {
return 1;
}
当str2为'0000'或者大于1个'0'的时候会出错
you can see his solution... there you will see why
impressive!
This comment is hidden because it contains spoiler information about the solution
well it's an
O(n)
solution and there is an obviousO(1)
solutionthat's why it does not deserve its insane 250 upvotes
explain further since you aren't making any sense.
Awesome!
I'm only doing Rust Katas because I've never used it before. It's nice to say why you think iterators are no good here, otherwise you're sort of trolling.
Iterable solution makes no sense as best practice here
You are not right. The only information the range contains is start index and end index and no additional information is used to generate values from range, so this solution actually requires constant memory.