At Notion, you need a utility that verifies whether a given string is a palindrome. A palindrome reads the same from left to right and right to left.
Write a function that takes a string s and returns True if s is a palindrome and False otherwise.
sTrue if s is identical to its reverseFalse otherwiseUse a direct algorithmic approach rather than relying on external libraries.
Example 1
Input: s = "racecar"
Output: True
"racecar" is the same when reversed.
Example 2
Input: s = "hello"
Output: False
The first and last characters do not match, so it is not a palindrome.
0 <= len(s) <= 10^5s contains printable ASCII charactersAn empty string should be considered a palindrome. Aim for a solution that runs in linear time.