Ad
  • Custom User Avatar

    Hey, an interesting scenario, but this should be treated the same way as any other. Let's say we have an array [-5, 10, 8, 10, 2, -3, 10]; as you can see there are 3 occurences of 10, but still the algorithm works the same way: the greatest is 10, so it goes in the middle, the next greatest is 10, so it goes on both sides, then 10 again on both sides, and after that the other numbers accordingly, resulting in [-5, -3, 2, 8, 10, 10, 10, 10, 10, 8, 2, -3, -5]. I added this to the tests for clarity nevertheless.

  • Custom User Avatar

    In the test cases where there are 1000 elements or more in the data array, the max number may not be unique. For example, if the max in the array is 1000, there can be multiple 1000s.

    This raises a question about how we should deal with the existence of multiple max numbers:
    Should we take them as just one element?
    Should we place the group of max numbers in the middle, and then arrange the rest of numbers in the mirroring fashion?

    Moreover, we may have an odd or even number of max numbers. Under the requirement of returning an array with an 'odd' number of elements in it, things can get more complicated.

    This possibility of having multiple max numbers and how it should be handled should be mentioned in the description, and the test cases may need to be reexamined as well.

  • Default User Avatar

    You can unpack any iterator with an asterisk, but the type of collection is still unspecified. Try printing out an iterator such as map, filter, or enumerate. Then try to print that object with an asterisk. You can see the numbers, but if you look closely, there is no parenetheses or square brackets or curly brackets. The unpacked numbers also can't be indexed if you didn't specify the collection type such as list, tuple, dictionary, or set

  • Custom User Avatar

    How i hate when you cant really see where is the problem..
    My code just should work...(not mutating original input)
    P.S. nah my bad, turns out i was mutating the original... xD

  • Custom User Avatar

    You're right, I ommited this in the sample tests. Already fixed that, but since sample tests are editable it's not that big of an issue.

  • Custom User Avatar

    I guess it's still not fixed, at least in Python.
    EDIT:
    at least in the initial "Sample Tests" pane here.
    At least that's how it looks for me.

  • Custom User Avatar

    If adding, subtracting and stretching vectors is common for you, you don't need that tip.

    If it isn't, that tip may very well help a solver build a mental model for performing the task, even if the actual solution doesn't use the full animal thingy.

    I liked the tip, and I did not find it misleading.

  • Default User Avatar

    Actually that tip is kind of misleading anyways. The solutions don't use this coordination system and it would overcomplicate it.
    Just use the common adding / subtraction / stretching of vectors.

  • Custom User Avatar

    Ruby 3.0 should be enabled, see this to learn how to do it

    Please organize the structure of test fixture as following (although it has been mentioned in the attached link, I'm repeated here again)

    describe "<This message should describe the categories of test groups inside this block>" do
      it "<A short message describing this test group>" do
        expect(...).to eq(...) #Assertions
        #Or Test.assert_equals(user_response, reference_response)
      end
    end
    
  • Custom User Avatar

    Ruby 3.0 should be enabled, check details here and here.

    And if possible update the github list.

  • Default User Avatar

    images are no longer exist

  • Default User Avatar

    Performance-wise this solution is not really good...

  • Default User Avatar

    (half)moves boundary cases are not tested.

    For example:

    halfmoves = moves*2 (False)
    halfmoves = moves*2-1, active='w' (False)
    
  • Custom User Avatar

    I know, but if mutation was possible no, you can't.

  • Custom User Avatar

    Ehm, Chrono .. you can work back from expected to get the input.

  • Loading more items...