Ad
  • Default User Avatar
  • Default User Avatar

    These tests are checking whether the input list was modified. The kata requires that the original data remains intact and you create a new list.

  • Custom User Avatar

    Python tests are not functional. Some of the "correct" answers involve lists that have lower values at a greater index that some of the previous values.

  • Custom User Avatar

    Other languages see no change, it's just that LC needs some additional info. It's in an if-block. ( If you go to the translation Diff tab, you can see the changes. )

  • Default User Avatar

    does your addition change the description on Python, C, Haskell, etc.? or does it appear only on the LC description?

  • Default User Avatar

    this tests check that you haven't changed the input data. are you returning a new array?

  • Default User Avatar

    somebody can help me?
    so i try mi code in google colab and the answer its okay, but in my test the program says me "the function give [2,2,1,2,2] and should be equal to [2,2,2,2,2] but when a run in colab this same example the program its right.

  • Custom User Avatar

    LC translation

    this translation modifies the description

  • Default User Avatar

    thank you for that very clear, detailed explaination!

  • Default User Avatar

    At a language level:

    (1)

    void func (size_t len, int *array)
    

    (2)

    void func (size_t len, int array[])
    

    (3)

    void func (size_t len, int array[8])
    

    (4) (if the compiler supports Variable-Modified types)

    void func (size_t len, int array[len])
    

    compile to the same code. The first dimension of an array decays into a pointer when passed to a function, so * array and array[] are equivalent. And the length in (3) and (4) is not used (but it helps the compiler diagnose some cases of out-of-bounds access, for example GCC detects this:

    void f (int[4]); // takes an array of length 4
    int array[2];
    f(array); // warning, array too small
    

    However, it is good practice to use the * notation for pointers to a single variable, and the [] notation for arrays; it makes the code more self documenting.
    Same remark for the length hint, it makes its purpose immediately obvious.

    (the only downside of (4) is that VM types are an optional feature for now. They will be made mandatory in C23, but currently they are not available on Microsoft's compiler. This means (4) would not compile on MSVC).

  • Default User Avatar

    set-up solution has been adjusted for both.

    what's your explaination about the notation difference?

    thanks

  • Custom User Avatar

    Approved by someone

  • Custom User Avatar

    Guys, thank you for pointing out my mistake, I didn't read the assignment carefully.
    In the function, I worked with the incoming array, but I had to copy and then work with the new array

  • Custom User Avatar

    With the lines :

    data[1] = data[0]
    data = data[1:] + data[:1]
    

    You are mutating the original array...

    Also, it's not an issue with the kata but with your code. So it's a question.

  • Default User Avatar

    00000000000000input array was modified:00000000000000

  • Loading more items...