didn't worked at the first time
This comment is hidden because it contains spoiler information about the solution
As it should, frankly.
THIS PROVES MY BRAIN IS BETTER THAN A COMPUTER!
Had exactly this (i thought) and didn't pass 1 (out of dozens of test ran)... weird...
the best way! )
I have a similar solution, however since isupper() has some issues with uncased characters from unicode I dont think this should be the best practice for python.
inp.upper()==inp seems more reliable IMO.
This solution does't work with non-alphanumeric characters.
fucking hell, i didnt know that. Look at my solution, ffs smh
difference between O(n) and O(3n) is only about micro-optimizations. Meaning you cannot have any general rule about that. That's precisely why, when talking about time complexity, you're always reducing O(3n) to O(n).
For example, doing only 1 pass, you'll generally need extra condition checks. That takes time... => That slowes down the O(n) implemetation... => That's microoptimization matter... => That's pointless to make general comparisons between O(n) and O(3n) because behaviors will depend on compiler, implementation, interpreter if any, ..., ..., ..., ...
Big O notation is cool, but n is still way better than 3n.