Ad
  • Custom User Avatar

    OP solved it with built-in methods, closing

  • Custom User Avatar
    • @LaurentBouvier - You are mixing up n and m, in (2,1), there are 3 points on a line, and 2 more on the arc.
    • @sadegh-moayedizadeh - You are ignoring the 2 points on the edges of the diameter and arc (A and B)
  • Custom User Avatar

    The Maybe monad in Haskell can be baffling. Don't focus on the Int / Integer question here, the problem is Maybe needs to be handled in a special way. I cannot see how I could help you without giving away the solution, sorry, but I hope you will find some helpful informations there: https://wiki.haskell.org/Maybe

  • Custom User Avatar

    You are wrong. If the base (12 in this case) is even, according to the logic of multiplying, the result must be even too.

  • Custom User Avatar

    I have the same question .... We have the example combinations(2,1) -->(9,3)
    In this configuration, we have all the points in a line but one ==> I don't see a way to have a quadrilaterals which is not a triangle + one point on one of the side. I think we need to take the name quadrilaterals in an extend way...

  • Custom User Avatar
    >>> 2**(2**(1**2))
    4
    >>> 3**(3**(0**0))
    27
    >>> 3**(4**0)
    3
    >>> 2**(3**2)
    512
    >>> 
    
  • Custom User Avatar

    Don't calculate all primes everytime while run each gap(g, m, n), put primes outside the gap() func. I get all nth-primes in O(n) time complexity still time out.Good luck~ after solved, you may find this hint is nothing~ LooooL~

  • Custom User Avatar

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

  • Custom User Avatar

    There is an algorithm better than linear. Do some more research, and see if mysterious hint at the end of the description is any helpful.

  • Custom User Avatar

    You're welcome, recursion is a bit tricky until you get the hang of it. Now that you solved it without it, see other solutions that use recursion and analyze how they work.

  • Custom User Avatar

    No problem, the answer to your problem was there too btw:

    Check if your solution passes two successive calls with different inputs. It's sometimes the case that solution contains some global variables or static members and stale state is carried over from one invocation to another.

  • Custom User Avatar

    Already answered below.

  • Custom User Avatar

    Because you used a global var, and it keeps its value when your function is called more than once. Please, I know you said you read it, but read this again: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution it says there also how to post code with markdown formatting, etc. We wrote it so we don't need to repeat the same over and over.

  • Custom User Avatar

    I mean, there are different labels for posts here, it's documented in the github page, I'll copy and paste what it says about it:

    • Mark your post with Question label if you have some problems solving the kata and want to ask for help.
    • Mark your post with Suggestion label if you want to propose some changes or improvements to discussed kata. It's also customary when posting a translation to post a link as a suggestion as well, in case the notification gets lost.
    • Mark your post with Issue label only if you are perfectly sure that kata is in some way broken, and needs to be edited and fixed. If you have difficulties with solving the kata, raise a Question, and not an Issue.
  • Custom User Avatar

    Without a way to reproduce your claim, this is "trust me bro". And that trust is usually not deserved with a comment to this effect. There's no way that others can know that this is different. It probably doesn't lead anywhere either even if you're right, because that still doesn't say what the problem is.

  • Loading more items...