Ad
  • Custom User Avatar

    Is your algorithm covering the classes of 2181 to 2189? The next musical will be in 2195 and the classes that enrol in 2187, 2188 and 2199 will get to see that musical, leaving the classes of 2181 - 2186, the other six classes

  • Custom User Avatar

    Can you help me with this example?.

    I'm looking this random test with an answer of 56:

    start = 2075
    end = 2189
    musical_every = 15
    enrollment_duration = 8

    The years of musicals are below.

    [2075, 2090, 2105, 2120, 2135, 2150, 2165, 2180]

    Between each interval, 7 students won't see the musical and there are 7 intervals, so.
    7 * 7 = 49 students in total will miss the musical. The person who enroll in 2181 won't see
    the final musical in the end class. So 49 + 1 = 50. Where are the other six persons.

  • Custom User Avatar

    Not necessarily. There will always be a musical for the start class only unless the school does no musicals. For the end class, it will depend on the duration for a musical to take place and also the duration of enrolment in school.

  • Custom User Avatar

    So in the end class there will be also a musical no matter what?

  • Default User Avatar

    I wasn't really expecting that one to be added, but maybe a somewhat more strenuous test is needed to weed out attempts (like my first) that are actually plain wrong.

    EDIT: Also, I just looked, the 2kyu version doesn't include Javascript, which is a shame. Not there yet with Python.

  • Custom User Avatar

    hi, that won'tbe added here, since this version isn't supposed to handle such a kind of grid. But you can try your solution on the 2kyu version.

  • Default User Avatar

    I re-submitted a solution, since although my original passed the tests, it would have definitely failed on some puzzles. E.g. the (supposed) hardest ever puzzle (below).

    var puzzle = [
        [8,0,0,0,0,0,0,0,0],
        [0,0,3,6,0,0,0,0,0],
        [0,7,0,0,9,0,2,0,0],
        [0,5,0,0,0,7,0,0,0],
        [0,0,0,0,4,5,7,0,0],
        [0,0,0,1,0,0,0,3,0],
        [0,0,1,0,0,0,0,6,8],
        [0,0,8,5,0,0,0,1,0],
        [0,9,0,0,0,0,4,0,0],
    ];
    var solution = [
        [8,1,2,7,5,3,6,4,9],
        [9,4,3,6,8,2,1,7,5],
        [6,7,5,4,9,1,2,8,3],
        [1,5,4,2,3,7,8,9,6],
        [3,6,9,8,4,5,7,2,1],
        [2,8,7,1,6,9,5,3,4],
        [5,2,1,9,7,4,3,6,8],
        [4,3,8,5,2,6,9,1,7],
        [7,9,6,3,1,8,4,5,2],
    ];
    

    It's probably too late but maybe harder tests might filter out false solutions like my original submission.

  • Default User Avatar

    And ... it works.

    Not sure what to take from this, except 'turn it off and on again' :)

    Thanks a lot for sticking with this.

    Ps. I will look at some of the amazingly concise solutions for some of the tools you mentioned.

  • Custom User Avatar

    ooookayyy....... :/

    Weirdest thing: I tried your solution against the actual test suite and it works like a charm...

    1. copy your code
    2. reset the trainer
    3. refresh the page
    4. try again

    => ?

  • Default User Avatar

    I updated it with a much smaller example (and put the back-ticks in).

  • Custom User Avatar

    put backticks around the input otherwise the "coment engine" will chop some of them, thinking it's formatting.

  • Default User Avatar

    I was trying to fulfill the bonus bits ...

    -Avoid creating an array whose memory footprint is roughly as big as the input text.
    -Avoid sorting the entire array of unique words.

    Hers's an example of input that fails:

    'BxhhnNv':,?'BxhhnNv'._.?.'BxhhnNv'.'BxhhnNv'??'BxhhnNv',,,!;'BxhhnNv'-'BxhhnNv'-;'BxhhnNv'_-'BxhhnNv'..!,!'BxhhnNv'._: -'BxhhnNv'-;'BxhhnNv';'BxhhnNv'_'BxhhnNv':..,.'BxhhnNv'_,??

    The fail message is:

    Incorrect match: words not present in the string. Your output: ['bxhhnnv']. One possible valid answer: ["'bxhhnnv'"]

    As I say though, locally I get the valid answer.

  • Custom User Avatar

    (lots of "antipatterns", in there... Mostly because you don't know yet some tools that python provides) ;o

    Well, I'm surprised to realize I actually didn't ask for something...: what was the input, for what you described in the first message?

  • Default User Avatar

    Thanks for that, I ended up using a html pre tag - it's readable now.

  • Custom User Avatar
  • Loading more items...