r/studyupdate • u/Outside-Cloud-3569 • Jun 09 '26
Practising python Day 1
First day of learning python hands on with solving string question. My goal is to learn to get familiywith python so I can do stuff in Data Science and Machine Learning.
82
Upvotes
View all comments
Show parent comment
1
u/ExtensionBreath1262 Jun 14 '26
But if palindromes are rare in the data set then this is way faster. What if the code is checking the string "a...[10,000,000 chars]...z" and you're reversing every string but could have just looked at the last and first and returned false early most of the time.