Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
nice kata
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.
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.
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 translationDiff
tab, you can see the changes. )does your addition change the description on Python, C, Haskell, etc.? or does it appear only on the LC description?
this tests check that you haven't changed the input data. are you returning a new array?
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.
LC translation
this translation modifies the description
thank you for that very clear, detailed explaination!
At a language level:
(1)
(2)
(3)
(4) (if the compiler supports Variable-Modified types)
compile to the same code. The first dimension of an array decays into a pointer when passed to a function, so
* array
andarray[]
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: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).
set-up solution has been adjusted for both.
what's your explaination about the notation difference?
thanks
Approved by someone
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
With the lines :
You are mutating the original array...
Also, it's not an issue with the kata but with your code. So it's a question.
00000000000000input array was modified:00000000000000
Loading more items...