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.
Rust issue. Instructions expect to return unsigned -1 for no available solution, check is for None in this case.
Look at the last example in the kata's description again. Your code returns -1 when the expected answer is 0.
dont understand my result log:
The array was: [20,10,-80,10,10,15,35]: expected -1 to equal +0
+0 ???
Documentation suggests that package
slices
is only available since version 1.21, but only 1.20 is available at the moment. So, don't import unsupported packages.I can't import "fmt" or "slices", error follows:
package slices is not in GOROOT (/usr/local/go/src/slices)
what do I do?
He asks to give the "next" bigger integer, according to this example, after 2017 (using the same numbers we have) the next bigger integer is 2071 which we get by changing the last 2.
Well, generating permutations is not the correct way to go about this task. If the number contains a lot of digits, you will end up generating a huge amount of different permutations, which is what leads to your timeout. Look for a pattern between the input that you're given and the correct return value. There is a method to figuring out the next highest number. Try this kata if you're stuck: Basics 08: Find next higher number with same Bits (1's). It's a very similar premise, but it's made simpler by the fact that you're only dealing with 1's and 0's. If you can spot the pattern there, you may be able to apply that knowledge to this kata.
Interesting task, in python I implemented generator that generates next element of permutation for those numbers. Seems to work fine but test cases are timing out after 3/4 test cases for bigger numbers. Any hints for optimazation?
thanks,
The task is to return next bigger number with the same digits, not the biggest number with the same digits.
How can 2017 return 2071? Since 7210 is the largest number with its digits?