def reverseWords(self, s): s.reverse() ind = 0 for i in range(len(s)): if s[i] == '': s[ind:i] = reversed(s[ind:i]) ind = i + 1 s[ind:] = reversed(s[ind:])
Leetcode does not accept this code, while it works perfectly when I run it normally. Any idea as to what might be the issue here ?
@bhanuverma How can this be correct? This condition
s[i] == '' will never be true.