I don’t know how you’re 70% sure
Sorry for that. It’s just that I’ve seen python ‘templates’ on HackerRank and they also had unnecessary imports that matched exactly with the unnecessary
#includes in their C++ templates. A lot of other things were not written in ‘pythonic’ way so that made me believe that those HackerRank templates were lazily converted.
Your code is was very similar to one of those templates that’s why I said that.
Morever print(‘1’) was required to be printed over other not ‘i’.
From the problem page:
Output in single line “OK” (without double quotes) if Triplet Bubble Sort correctly sorts the list, or the index (counting starting from 0) of the first sorting error, as described in the problem.
i in your loop is the index of the first sorting error. Also note the difference between
It is possible that there is a test case with n = 1 and since your code prints ‘1’, the runtime error is actually in the checker for the problem. Try submitting after removing the
imports and the