Same strategy working in C but not in python. What could be the reason?

Getting runtime(nzec) error for solution submitted in python whereas similar approach worked in C. Am I missing something that in python. The solution for in python is and in c is Can anyone point what is the wrong that Iam doing in python.

Instead of just :


submit using:


The reason may be that the author has left leading white spaces at the end of input,the strip() function just removes all the leading white spaces,there is no problem with these leading white spaces for ā€˜cā€™ because scanf() ignores them,where as for input() method in python,the input should be strictly integer.By the way I think your algorithm may not pass the Time limit? just think about it.I guess this may help you

1 Like