def is_palindrome(s: str) -> bool:
    """Return whether a string is a palindrome

    This is as efficient as you can get when computing whether a string is a
    palindrome. It runs in O(n) time and O(1) space.
    """
    if len(s) <= 1:
        return True

    i = 0
    j = len(s) - 1

    while i < j:
        if s[i] != s[j]:
            return False

        i += 1
        j -= 1

    return True