educative.io

Educative

Some suggestions about problem and solutions in python

For the interface of problems in python, highly recommend change the variable name from str to s as str is actually a type name in python, it may cause some issues
In solution, when try to build the dictionary of pattern, highly recommend that using following code:
from collections import Counter
count = Counter(pattern)

1 Like

Hi @Miao,

Thank you so much for reaching out to us.

Thank for this we have changed str with str1.

Yes, that is a wonderful approach but we are trying to keep the same code for Python, Java, C++and JavaScript, and for that, we have to use this approach. If there is anything else we could help you out with, please do let us know. Thanks.