Be careful with solutions like this because you are iterating through nums for each element of nums making it O(n^2) time complexity. This gets very slow as the size of nums grows. You can accomplish the same result by iterating through nums only once or twice. Obviously for these test cases nums isn't long enough to matter though.
No, even merge sort is O(n * logn). Since we don't know if the array is sorted, we need to look at each element at least once. Otherwise, we wouldn't be able to tell if the array is sorted. I believe the best that can be done is O(n).
It seems to me, (a novice in C) that the random tests were not random.
When hitting attempt, random tests are done. I print the inputs and output of my function. When repeatedly hitting attempt, I get exactly the same inputs and outputs again and again.
I am stuck at the random test,
Be careful with solutions like this because you are iterating through nums for each element of nums making it O(n^2) time complexity. This gets very slow as the size of nums grows. You can accomplish the same result by iterating through nums only once or twice. Obviously for these test cases nums isn't long enough to matter though.
Cheers!
just didn't get it, besides there was condition "add one character and remove one character" !?
No problem.
thanks dude !!
Passed: 65 Failed: 2
Exit Code: 1
Expected: -486 Submitted: 481
i thought that the input would be a positif integer
Read this: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution
Have you seen which input makes your code fail?
This comment is hidden because it contains spoiler information about the solution
No, even merge sort is O(n * logn). Since we don't know if the array is sorted, we need to look at each element at least once. Otherwise, we wouldn't be able to tell if the array is sorted. I believe the best that can be done is O(n).
What the hell... I never knew there was a title() method and I used capitalize() and map()
Random tests generate random cases now.
Resolved.
I can't verify this, can you verify that whether it is fixed now?
for C
It seems to me, (a novice in C) that the random tests were not random.
When hitting attempt, random tests are done. I print the inputs and output of my function. When repeatedly hitting attempt, I get exactly the same inputs and outputs again and again.
for C
a very small issue where tests generate a warning of
[-Wincompatible-pointer-types]
C and C++ translations. Please review.
Loading more items...