My Intention was not to send the wrong solution , But I was just submitted my code to check what distribution of K in this problem, I was also expecting WA but I got AC this is also not my fault. If I have done this intentionally I never mention that I got AC with wrong solution. I was just a bit Lucky that I got AC with some AD-HOC solution.
this problem is really buggy, @lakshman1988 exploited it. Surprised to see that solution doesnāt depend on the value of K.
āa solution which can not pass the sample test case, gets AC?ā cant stop laughing
Since we cannot change more than ākā elements the last element(read maximum) has to be one of the last ākā (read maximum ākā elements of the list). Same holds true for first element.
which problem has 9-10k accepted solutions??
Moreover only some random solutions need to be seen.
Further if you see the example above by @dcod, you should realise that the test cases were useless! This was a trivial thing that deserved a few test cases. I wont accept the point that testers could not think of this.
Setterās Solution :Main idea: From first k + 2 elementh we can choose two numbers that will not change. Use brute force for first K + 2 numbers. Final solution is O(K ^ 2 * N).
Why are v choosing from first k+2 only?