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.
:3
Now it passed 2 months since I solved this kata. I find quite good book "Beyond the Basic Stuff with Python - Al Sweigart" and I learned about "Big O" analysis and now I know cProfile.run() function also. Anyway great thanks once again.
@fibritco: you're supposed to apply a reduction of all the elements in the range, using that operator.
a+b+c
is unambiguous as a result of the associative property of addition.I didn't intend for the performance aspect of this kata to be concealed. In trying to be brief, all I said in the description was "Some tests will include very large numbers."
While the algorithmic runtime is important here, a scheme can be devised that is more of a function of the number of digits in the input. Maybe it would be less of a surprise if the input were a string rather than an integer -- but I imagine I'd still have folks converting that to an integer type and doing math with it.
Regardless, a major hint is to think about the challenges with finding the next smaller number of a relatively small input by hand. I don't know your implementation, but consider an input of: 21000. Would a person solving this really need to test whether 11999, 11998, 11997, and so on -- contain the same digits? If you can think of strategies for rearranging the digits you'll be in a better position, but naively considering permutations of all digits in order to find the next smaller is likely to time out (as the count of permutations involves factorials that can also grow quite large -- the 5 digit number would have 5! or 120 different permutations most of which will be identical with the repeated digits.) Thinking about the conditions where there are no solutions can help too. If you can intuit that the next smaller number of 21000 is 20100 -- how can you knwo that is the right answer?
Hoping that this kata is fun and that folks learn something in their attempts. Cheers!
Crazy kata indeed ๐ต I also tried and failed - so far.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
very coool to practise the modulue operator but this should be 5KYU, you can solve it in under half an hour its so easy
Love this kata pure work to do, many things to learn and no so crazy puzzle like in many other katas ๐ ๐๐๐ (Python)
Hellow everyone,
(Python) one fast question "op" argument from def compute_ranges(arr, op, rs): takes only two arguments as op(a, b). Question: how to forse this "op" to swollow list with more than two arguments??? ๐คจ
Great thanks for answer so I will have to switch from iterto... to something else. New things to learn ๐
yes, I agree that is definitely a short way of solving the problem. Nevertheless, I am fairly certain that most people, who attempt a 4 kyu kata, are not necessarily aware of this function and would benefit from having a c++ translation.
Hello everyone,
could some one be so kind and tell me how fast the solution should be to solve it in the test? My code go through 2522ms in the test with all tests passed and unfortunatelly is to slow to solve "attempt" section. I wonder how many times I should improve code effectivenss?
Loading more items...