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.
Questions asks not to modify input array for some reason
Incorrect solution for problem - must modify input matrix.
Hey there, I just completed this one on Leetcode and thought I would grab some codewars points for it as well if it was on here.
I was wondering if someone could shed some light on my solution for me - while it does pass all the tests, am I not technically going against the rules of the problem by making another 2d-array?
I know I got around it by doing "matrix[:] = res", but doesn't that kinda beat the point of the problem? All my test cases were accepted on both Leetcode and here, but I wanted some clarification on whether this type of thing was allowed for questions that state "Do not return anything, modify matrix in-place instead."
Cheers!
So you are doing s = ...
The idea is that you dont mutate the input, which will be one of the errors you will get with this while code testing. I think you would likely also timeout with the [::-1] reverse method?
Dont change s (the input list)
Nice kata - thanks for this. A good emphasis on time complexity for this one. My first solution was really simple but obviously no good for very large lists.
My second one was faster, but only just scraped it with like 10000 ms haha, nice to see the other solutions though.
Nice solution!
Also totally agree, feels more like a 7 Kyu
Yeah ok makes sense, thanks
Please read the description of this kata carefully - the tests are correct!!
Much easier to solve this iteratively than recursively.
I personally had some testing issues when trying to import my recursive function (including a global count variable) into CW. I passed the 4 basic tests in my IDE, however when that same code inputted into CW the some of those basic tests failed. Maybe CW didn't like that I had declared a global variable within a function? Can anyone shine some light on this - Thanks
I have a similar issue, with a similar style question. I think he means that when he is running the same tests in his IDE, it returns the correct results. But when the same code is inputted into CW, some tests fail.
Not sure if this is because your IDE is python 3.8 and CW is running the question in 3.6?