Ad
  • Custom User Avatar

    Hi,

    The example you give:-
    sort_by_perfsq([234, 61, 16, 441, 144, 728]) == [144, 441, 16, 61, 234, 728]

    number of perfect squares: 2 2 1 0 0 0

    suggests that a perfect square should only be counted once even if it comes from
    2 or more sources. Hence 16 is counts 1, but 61 counts 0. If this is the case what are the
    rules for counting or disregarding in such an example.
    Also 234 counts 0, 324 variation being ignored. It seems the instructions in this kata are not
    clear enough.

  • Custom User Avatar

    See above, this occurs when you print the integer value.

  • Custom User Avatar

    Remember: if J comes before I in the key, then it's J that goes into the matrix rather than I, in short whoever comes first goes into matrix but will be used as both i and j

  • Custom User Avatar

    482 is correct:

    In[16]: 3 ** (3 ** 3)
    Out[16]: 7625597484987
    In[17]: pow(3, _, 1001)
    Out[17]: 482
    
  • Custom User Avatar

    I have an issue with one of the tests:
    For (3, 4, 1001) my solution give 27 whereas your's says it should be 482.
    A quick python check of (3**19683)%1001 gives 27, so I don't know who is correct

  • Custom User Avatar

    Difficult for a 7 kyu. Succeeded on my 3rd algorithm, after previous efforts timed out.
    Without giving too much away I think the trick is to work backwards, starting at the answer.
    I expect the more challenging version of this will be impossible.

  • Custom User Avatar
  • Custom User Avatar

    Hey @ihatemaths - thanks for your lovely message, it made my afternoon reading it! I thought I was one of the older people on the site, but you have me beat.

    My neighbor (79 years young) decided to take up triathlon last year and now I see him every other day in my town practicing his cycling - and I live in a mountain region! - so never say never about the maths learning ;)

    Happy new year and I hope you have a great 2023

  • Custom User Avatar

    I think I've got as far as I can on this. I time out on the last test group. Still,
    I've come a long way and learnt a lot which is the main thing. My solution is python, more
    or less one-liner, I haven't enough maths to get the clever solution, and at 76, I'm passed
    learning it. Nice kata, and thanks. I'll come back to it I ever any more inspiration.

  • Custom User Avatar

    This is another kata I will have to give up on due to inconsistancy of codewars' test harness.
    The instructions state 'i' and 'j' should be treated as the same. However, sometimes the encryption
    comes back with 'I', sometimes with 'J', apparently randomly. I don't suppose anyone will reply to this,
    as is the norm when commenting on an old kata, so I'll move on, as it is impossible to arrive
    at a solution that will satisfy the test harness. At least it wa an interesting challenge.

  • Custom User Avatar

    In the given example, where does 'qr' at the end of the split pairs in step 4 come from?

  • Custom User Avatar

    Looking through the posts for this kata, it seems the grouping split is not adequately defined. I think therefore I will not make an attempt at it. I don't want to waste my time. Either it should be corrected, or removed.

  • Custom User Avatar

    Please ignore my previous post. I see that the test script had got corrupted.
    I can see what it should be.

    Chris

  • Custom User Avatar

    Your test harness gives an error on the last test:-

    File "/workspace/default/tests.py", line 8
    test.assert_equals(upsidedown('100000','123456789000000),718650)00'
    ^
    SyntaxError: '(' was never closed

  • Custom User Avatar

    Hi @ihatemaths (nice username!),

    I copied your current solution locally, and performed a test with two inputs:

    a=0, b=10 -> returns 3 (this is the test in the Description)

    a=0, b=11 -> returns 4 this is incorrect, because the kata expects 3 if I'm not mistaken. Note that here, going from b=10 to 11 we have that 11 is an upside down number.

    The description says: "For example, solve(0,10) = 3, because there are only 3 upside down numbers >= 0 and < 10 so as you can see here the upper limit is NOT inclusive

    So tl;dr, it seems your code is currently counting the upper range limit value, when it should not.

  • Loading more items...