Why it took 54 ms even though the time complexity was O(n)
I recenty started solving questions on leetcode and came accross this Questions where we had to remove all alphanumeric characters from a string and then check if the string is a palindrome or not.
I tried to keep O(n) time complexity still it took 54 ms which is way too long can someone please explain. Here is the code: