Ad
  • Custom User Avatar

    Updated test cases. Didn't do the PS, but recognize that it's a good suggestion. Marking resolved.

  • Custom User Avatar

    I haven't been on in some time. I have added some examples and my own brief description of what a pronic number is. Thanks for the suggestion. Let me know what you think.

  • 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

    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

    I really liked the original -- mapping to JSON.parse was the clever part.
    Using reduceRight eliminated the need to reverse.
    Nice! :)

  • Custom User Avatar

    If you're asking this question, you probably have issues with the larger numbers in the submission tests.
    Without seeing your code, it's impossible to know.
    If you're timing out, it's hard to say whether your approach needs a simple tweak or a complete overhaul.

    Quick -- pretend like you're the computer running your algorithm and answer the following:

    What's the next smaller number from 90000001 with the same digits?

    Do you sense that you're doing unncessary work? Is there a simplification you can do?

    If that's no problem,try the same with the following: 912345678?

    If these are hard for you to attempt doing by hand using the algorithm you coded -- you should rethink your algorithm.
    If that's too much you might try a similar experiment in a debugger, stepping line-by-line and noting where your code is spending its time. Is there any unnecessary/pointless work being done?
    If that doesn't help, read the troubleshooting guide available in the codewars docs.

    Good luck! IMO it's the challenge of this exercise that makes it worth figuring out.

  • Custom User Avatar

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

  • Custom User Avatar

    Excellent points -- I would reinstate the list and the "if q" guard on the append. Particularly after finding this reaffirmation: https://stackoverflow.com/a/2414916

  • Custom User Avatar

    I love this solution; it is among the few for this kata that use functional programming at all. IMO, the lambda syntax in Python as compared to other languages where it is shorter makes it less desirable. I'm no language designer, I believe alternatives were weighed and there's good reason for it being this way.

    Among other qualities I appreciate, I like the limited abbreviations. Most solutions (including mine) use single letter variable names; this one uses: KEYBOARD, digit, sequence. It does use "q" and "r" -- for "quotient" and "remainder" -- which I can still appreciate over more generic: i,j,k,m,n,w,x,y,z or names that echo the type like 'str' (ooh, that's the argument to our method.)

    I will attempt a kumite/fork to explore a couple ideas. Well-done! 👍

  • Custom User Avatar

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

  • Custom User Avatar

    In this latter case with the it works! in the list-comprehension, we have a ternary expression instead of a filter. In the original comprehension, the 'if' at the end is a filter expression that indicates which elements to include.

  • Loading more items...