Ad
  • Custom User Avatar

    There appears to be a bug in the Python version's tests.

    Traceback (most recent call last):
      File "/workspace/default/.venv/lib/python3.10/site-packages/codewars_test/test_framework.py", line 112, in wrapper
        func()
      File "/workspace/default/tests.py", line 26, in fixed_tests
        values_count = sqrt+random.randrange(-round(sqrt/5), round(sqrt/5))
      File "/usr/local/lib/python3.10/random.py", line 353, in randrange
        raise ValueError("empty range for randrange() (%d, %d, %d)" % (istart, istop, width))
    ValueError: empty range for randrange() (0, 0, 0)
    
  • Custom User Avatar

    This code does create a method on the prototype. It does not create a separate function for every Ship instance. Test it for yourself if you don't believe me :)

  • Custom User Avatar

    The instructions specify You will get a String str with an even length, but the tests seem to be inputting strings of both parities for me using Python 3.8

  • Custom User Avatar

    Ok. To me, it seemed implied by the wording of the phrase "the total waiting time is", since the total waiting time is exactly what the solver must determine. I think there might be less potential for confusion if it read something like "the total waiting time if brewed in this order (which may not be optimal)".

    (Sorry, I'm trying to mark this question as resolved, but it's saying I'm not authorized to.) (edit: because Stefan30 already marked it resolved while I was typing this lol)

  • Custom User Avatar

    If you have the times: [5,3] you will need 5 minutes for the first coffee, and another 3 for the second, but in total, the waiting time for the first customer is 5 minutes, but for the second one is 2 minutes ( cleaning the machine ), 5 minutes ( the time you need to brew the first coffee ), and the 3 minutes you need for his coffee. So the total waiting time is: 5+2+5+3. This time depends on the order you choose to brew the cups of coffee.

    I'm confused. You said we can brew the cups in any order we want, so why can't we brew the 3-cup first and the 5-cup second for a total waiting time of 3+2+3+5?

  • Custom User Avatar

    Sorry if this is a stupid question: Is there any way to determine from the instructions what the expected output is for any given input, or is the intended solution for people to copy-paste the code from the linked Wikipedia page?

  • Custom User Avatar

    I have generated this placement for the last sample test, and I agree with the sample test code that its score is 72, which is higher than the hardcoded optimum score of 68. What's going on? Is it an invalid placement (and which rule does it break)?, or are both the sample test code and I miscalculating the score?, or is the hardcoded optimum score wrong (and should the optimum scores be hardcoded)?

     H ,eT , H ,   ,eH ,   ,   ,   ,   
    
     H ,eH , H ,   ,   ,eH ,   ,   ,eH 
    
       ,   ,   ,eH ,   ,   ,   ,   ,   
    
     H , H ,   ,   ,   ,   ,eH ,   , H 
    
     H , T , A ,   ,eH ,   ,   ,   ,   
    
       ,   ,   ,   ,   ,   ,   ,eH ,   
    
       ,   ,   ,   ,   ,   ,   ,   ,   
    
    eH ,   ,   ,   ,eH ,   ,   ,   ,   
    
       , H , H ,eH ,   ,   ,   ,   ,eH 
    
       , H ,eA , H ,   ,   ,   ,   ,   
    
  • Custom User Avatar

    The sample tests call countNeighbors, which is not defined. While the solver must work towards that functionality in the course of solving the kata anyway, if you intend for the solver to define and implement countNeighbors themself, it would be better to say so explicitly in the instructions rather than make them look through a bunch of sample test code to figure out its signature and expected output.

  • Custom User Avatar

    This kata has me reversed in the head. :/

  • Custom User Avatar

    😅Ahaha, sorry. Took me 12 myself

  • Custom User Avatar

    There appears to be no enforcement of the rule.

  • Custom User Avatar

    I assume ImmePak meant that the function iterates through the array twice: once to find the minimum, and again to find the maximum. Thinking about performance, it's theoretically unnecessary and somewhat inefficient to do that. (I don't know whether V8 optimizes it away; I assume not).

    However, I find this solution simple and easy to read. If this function would be called infrequently and on small arrays, it would waste only an insignificant amount of time.

  • Custom User Avatar

    Would it be reasonable to ask for more descriptive failure messages? I feel confused and frustrated after passing all 149 fixed tests but then seeing the second random test fail with the message "The element has been just added to the set."

  • Custom User Avatar

    Extended ASCII systems do, but ASCII at its most classical is actually seven-bit.

  • Custom User Avatar

    It's not, as my solution demonstrates (:

  • Loading more items...