Given a string S, check if it is palindrome or not.
Example 1:
Input: S = "abba"
Output: 1
Explanation: S is a palindrome
Example 2:
Input: S = "abc" 
Output: 0
Explanation: S is not a palindrome
 
Your Task: 
You don't need to read input or print anything. Complete the function isPalindrome()which accepts string S and returns an integer value 1 or 0.
Expected Time Complexity: O(Length of S)
Expected Auxiliary Space: O(1)
Constraints:
1 <= Length of S<= 10^{5}

Difficulty: EASY
Tags: String algorithms

Data structures
Skill types: Data structures
Expected Time Complexity: O(Length of S)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3

class Solution:

	def isPalindrome(self, S):

		# code here

Solutions:
class Solution:

	def isPalindrome(self, S):
		return 1 if S == S[::-1] else 0


class Solution:

	def isPalindrome(self, S):
		n = len(S)
		for i in range((n + 1) // 2):
			if S[i] != S[n - i - 1]:
				return 0
		return 1


class Solution:

	def isPalindrome(self, S):
		if len(S) <= 1:
			return 1
		i = 0
		j = len(S) - 1
		while i < j:
			if S[i] != S[j]:
				return 0
			i += 1
			j -= 1
		return 1


class Solution:

	def isPalindrome(self, S):
		left = 0
		right = len(S) - 1
		while left < right:
			if S[left] != S[right]:
				return 0
			left += 1
			right -= 1
		return 1


class Solution:

	def isPalindrome(self, S):
		n = len(S)
		i = 1
		while i < n // 2 + 1:
			if S[i - 1] == S[n - i]:
				i += 1
			else:
				return 0
		return 1


class Solution:

	def isPalindrome(self, S):
		str1 = ''
		for i in range(len(S) - 1, -1, -1):
			str1 = str1 + S[i]
		if S == str1:
			return 1
		else:
			return 0


class Solution:

	def isPalindrome(self, S):
		strlen = len(S)
		j = -1
		check = 1
		for i in range(0, int(strlen / 2)):
			if S[i] != S[j]:
				check = 0
				break
			j = j - 1
		if check == 0:
			return 0
		else:
			return 1


class Solution:

	def isPalindrome(self, S):
		l = 0
		sl = len(S)
		for i in range(sl // 2):
			if S[i] != S[sl - 1 - i]:
				return 0
		return 1


class Solution:

	def isPalindrome(self, S):
		return int(S == S[::-1])


class Solution:

	def isPalindrome(self, s):
		if s == s[::-1]:
			return 1
		else:
			return 0


class Solution:

	def isPalindrome(self, S):
		A = S[::-1]
		if A == S:
			return 1
		return 0


class Solution:

	def isPalindrome(self, S):
		sr = list(S)[::-1]
		srs = ''
		for i in sr:
			srs += i
		if srs == S:
			return '1'
		else:
			return '0'


class Solution:

	def isPalindrome(self, S):
		n = len(S)
		if n == 1:
			return 1
		if n == 0:
			return 0
		left = 0
		flag = 0
		right = n - 1
		while left < right:
			if S[left] != S[right]:
				return 0
			else:
				flag = 1
			left += 1
			right -= 1
		if flag == 1:
			return 1


class Solution:

	def isPalindrome(self, S):
		l = 0
		r = len(S) - 1
		while l < r:
			if S[l] != S[r]:
				return 0
			l += 1
			r -= 1
		return 1


class Solution:

	def isPalindrome(self, S):
		arr = [x for x in S]
		arr.reverse()
		brr = [x for x in S]
		flag = 1
		for i in range(int(len(arr) / 2)):
			if arr[i] != brr[i]:
				flag = 0
				break
		return flag


class Solution:

	def isPalindrome(self, S):
		low = 0
		n = len(S)
		high = n - 1
		while low <= high:
			if S[low] != S[high]:
				return 0
			low += 1
			high -= 1
		return 1


class Solution:

	def isPalindrome(self, S):
		n = len(S)
		if len(S) % 2 == 0:
			s1 = S[:n // 2]
			s2 = S[n // 2:]
		else:
			s1 = S[:n // 2]
			s2 = S[n // 2 + 1:]
		if s1 == s2[::-1]:
			return 1
		else:
			return 0


class Solution:

	def isPalindrome(self, s):
		n = len(s)
		mp = n / 2 if n % 2 == 0 else (n + 1) / 2
		mp = int(mp)
		for i in range(mp):
			if s[i] != s[n - i - 1]:
				return 0
		return 1


class Solution:

	def isPalindrome(self, S):
		if len(S) % 2 == 0:
			i = len(S) // 2 - 1
			j = len(S) // 2
		else:
			i = j = len(S) // 2
		while i >= 0 and j < len(S):
			if S[i] != S[j]:
				return 0
			else:
				i -= 1
				j += 1
		return 1


class Solution:

	def isPalindrome(self, S: str) -> int:
		for i in range(len(S) // 2):
			if S[i] != S[len(S) - i - 1]:
				return 0
		return 1


class Solution:

	def isPalindrome(self, S):
		start = 0
		end = len(S) - 1
		while start < end:
			if S[start] != S[end]:
				return 0
			start += 1
			end -= 1
		return 1


class Solution:

	def isPalindrome(self, S):
		S = ''.join((e for e in S if e.isalnum())).lower()
		return int(S == S[::-1])


class Solution:

	def isPalindrome(self, S):
		a = S[::-1]
		if a == S:
			return 1
		return 0


class Solution:

	def isPalindrome(self, S):
		rev = S[::-1]
		if S == rev:
			return 1
		return 0


class Solution:

	def isPalindrome(self, S):
		rev = ''
		for i in S:
			rev = i + rev
		if S == rev:
			return 1
		else:
			return 0