Ad
  • Custom User Avatar
  • Custom User Avatar

    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.

  • Custom User Avatar

    @fibritco: you're supposed to apply a reduction of all the elements in the range, using that operator.

  • Custom User Avatar

    a+b+c is unambiguous as a result of the associative property of addition.

  • Custom User Avatar

    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!

  • Custom User Avatar

    Crazy kata indeed ๐Ÿ˜ต I also tried and failed - so far.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    very coool to practise the modulue operator but this should be 5KYU, you can solve it in under half an hour its so easy

  • Custom User Avatar

    Love this kata pure work to do, many things to learn and no so crazy puzzle like in many other katas ๐Ÿ‘ ๐Ÿ‘๐Ÿ‘๐Ÿ‘ (Python)

  • Custom User Avatar

    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??? ๐Ÿคจ

  • Custom User Avatar

    Great thanks for answer so I will have to switch from iterto... to something else. New things to learn ๐Ÿ˜„

  • Custom User Avatar

    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.

  • Custom User Avatar

    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...