You are viewing a single comment's thread. Return to all comments →
Can't pass test case#4 and onwards... Any help optimizing the following python 3?
newS=s[left:right+1]
sub=[newS[i:i+j] for j in range(1,len(newS)+1) for i in range(len(newS)-j+1)]
print(len(set(sub)))
Seems like cookies are disabled on this browser, please enable them to open this website
How Many Substrings?
You are viewing a single comment's thread. Return to all comments →
Can't pass test case#4 and onwards... Any help optimizing the following python 3?
newS=s[left:right+1]
sub=[newS[i:i+j] for j in range(1,len(newS)+1) for i in range(len(newS)-j+1)]
print(len(set(sub)))