Ad
  • Custom User Avatar

    pretty cool!! my solution uses the same logic but this code snippet is crisp and clear!

  • Custom User Avatar

    I'd suggest using Array#length or Array#size instead of Array#count here as they don't check whether a block was given.

    Awesome solution overall, the array-adding one-liner is pure gold for readability here.

  • Default User Avatar

    I encountered the same problem (with the very obvious answer in Ruby), and hadn't a clue how to fix (circumvent) the problem in the test cases. While debugging, I put a p string as the first line in the method... and got the solution accepted. You might want to try that.

  • Custom User Avatar

    I got that also. I don't how I can fix that.

  • Custom User Avatar

    Please fix!

  • Custom User Avatar

    Thanks Matt, that I'll do :)

  • Default User Avatar

    Yeah good point, this still isn't fixed. Thought it was an issue with my code as I was using the "permutation" method!

  • Custom User Avatar

    This test is super easy in Ruby, nontheless the submit tests do not pass.

    It prints

    {"stdout":"Basic tests\nunique letters\nTest Passed: Value == [\"a\"]\nTest Passed: Value == [\"ab\", \"ba\"]\nTest ...
    

    Any clue ?

  • Custom User Avatar

    Has anyone found a non-brute force solution they want to summarize? I know there's a lot of pathfinding theory in games and such. It's also clear you could optimize the common case (always guess "towards the exit" as a first priority), but I couldn't think of a way to optimize in the worst case.

  • Custom User Avatar

    With this data structure you can index into the map as map[x][y], so you get the natural-ness of x,y coordinate addressing. I actually thought it made great sense. Is it more intuitive a different way?

  • Custom User Avatar

    For JS: Reusing the same map instance across tests has suprising side effects.

    While it's true we should be aware of whether or not we're mutating references, but I'd probably like that explitly allowed or disallowed in the instructions in this case.

    Marking visited coords in the map reference would be awfully convenient if it were allowed! Of course we could copy but in JS you need a deep copy so it's not a terse solution.

  • Custom User Avatar

    depends how the tests are written, sometimes the same object is passed into your solution and a validating solution. So if you modify the array the validting solution will get your modified version and will return a different result than expected.

    it's good to stay safe and make a copy of any objects passed in usually :)

  • Custom User Avatar

    Thank you very much ! I tried it before but since I am a noob I was not very confident.
    So I tried again with a deeper copy (using mapito = minemap.map { |e| e.dup } in Ruby) and I worked.

    Still... it is the first time it happens. I have no idea how I can avoid this in the future.

  • Custom User Avatar

    make sure you're not modifying any parameters, make a copy of the map array and use that.

  • Custom User Avatar

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

  • Loading more items...