Given a Integer array A[] of n elements. Your task is to complete the function PalinArray. Which will return 1 if all the elements of the Array are palindrome otherwise it will return 0.
Example 1:
Input:
5
111 222 333 444 555
Output:
1
Explanation:
A[0] = 111 //which is a palindrome number.
A[1] = 222 //which is a palindrome number.
A[2] = 333 //which is a palindrome number.
A[3] = 444 //which is a palindrome number.
A[4] = 555 //which is a palindrome number.
As all numbers are palindrome so This will return 1.
Example 2:
Input:
3
121 131 20
 
Output:
0
Explanation:
20 is not a palindrome hence the output is 0.
Constraints:
1 <=T<= 50
1 <=n<= 20
1 <=A[]<= 10000

Source: geeksforgeeks | Difficulty: EASY
Tags: Data structures

Starter code: # Your task is to complete this function

# Function should return True/False or 1/0

def PalinArray(arr ,n):

    # Code here



Solutions:
def PalinArray(arr, n):
	res = []
	for i in range(n):
		rev = str(arr[i])
		if rev != rev[::-1]:
			res.append(rev)
	if len(res) == 0:
		return 1
	else:
		return 0


def is_palindrom(num):
	reverse = 0
	temp = num
	while num > 0:
		rem = num % 10
		reverse = reverse * 10 + rem
		num //= 10
	return reverse == temp

def PalinArray(arr, n):
	for i in range(n):
		arr[i] = is_palindrom(arr[i])
	for i in range(n):
		if not arr[i]:
			return 0
			break
	return 1


def PalinArray(arr, n):
	for ele in arr:
		if str(ele) != str(ele)[::-1]:
			return False
	return True


def PalinArray(arr, n):
	count = 0
	for i in range(0, n):
		a = str(arr[i])
		if str(arr[i]) == a[::-1]:
			count += 1
	if count == n:
		return 1
	else:
		return 0


def PalinArray(arr, n):
	for i in range(0, n):
		m = arr[i]
		sum1 = 0
		while m > 0:
			rem = m % 10
			m = m // 10
			sum1 = sum1 * 10 + rem
		if sum1 != arr[i]:
			return 0
	return 1


def PalinArray(arr, n):
	for i in range(n):
		if str(arr[i]) != str(arr[i])[::-1]:
			return 0
	return 1


def PalinNumber(n):
	if str(n) == str(n)[::-1]:
		return True
	else:
		return False

def PalinArray(arr, n):
	for i in arr:
		if not PalinNumber(i):
			return False
	return True


def PalinArray(arr, n):
	res = [i for i in arr if str(i) != str(i)[::-1]]
	return 0 if res else 1


def PalinArray(arr, n):
	for i in arr:
		string = str(i)
		if string == string[::-1]:
			continue
		else:
			return 0
	return 1


def palindrome(val):
	val = str(val)
	l = len(val)
	for i in range(l // 2):
		if val[i] != val[l - i - 1]:
			return 0
	return 1

def PalinArray(arr, n):
	for i in range(n):
		if palindrome(arr[i]) == 0:
			return 0
	return 1


def PalinArray(arr, n):
	count = 0
	for ele in arr:
		if ele == int(str(ele)[::-1]):
			count = count + 1
	if count == n:
		return 1
	else:
		return 0


def PalinArray(arr, n):
	temp = n
	for i in range(n):
		n = arr[i]
		rev = 0
		while n > 0:
			sum = n % 10
			rev = rev * 10 + sum
			n = n // 10
		if rev != arr[i]:
			return False
	return True


def PalinArray(arr, n):
	result = [num for num in arr if str(num) != str(num)[::-1]]
	return 0 if result else 1


def PalinArray(arr, n):
	result = []
	for i in range(n):
		num = str(arr[i])
		revnum = num[::-1]
		if num != revnum:
			result.append(num)
	if len(result) == 0:
		return 1
	else:
		return 0


def PalinArray(arr, n):
	output = 0
	for i in arr:
		if str(i) == str(i)[::-1]:
			output = 1
		else:
			output = 0
			break
	return output


def PalinArray(arr, n):
	fin = []
	num = []
	rev = 0
	for i in arr:
		num.append(i)
	for i in range(n):
		while arr[i] != 0:
			rem = arr[i] % 10
			rev = rev * 10 + rem
			arr[i] = arr[i] // 10
		fin.append(rev)
		rev = 0
	if num == fin:
		return 1
	else:
		return 0


def PalinArray(arr, n):
	for index in range(n):
		test_num = 0
		original_num = arr[index]
		while original_num != 0:
			last_digit = original_num % 10
			test_num = test_num * 10 + last_digit
			original_num = int(original_num / 10)
		if arr[index] != test_num:
			return 0
	return 1


def PalinArray(arr, n):

	def reverse_num(num, reverse=0):
		while num:
			(num, digit) = divmod(num, 10)
			reverse *= 10
			reverse += digit
		return reverse
	for num in arr:
		if num != reverse_num(num):
			return 0
	return 1


def PalinArray(arr, n):
	C = 0
	for i in range(0, n):
		S = str(arr[i])
		RS = S[::-1]
		if S == RS:
			C = C + 1
	if C == n:
		return 1
	else:
		return 0


def PalinArray(arr, n):
	l = []
	for i in arr:
		s = 0
		d = i
		while d != 0:
			s = s * 10 + d % 10
			d = d // 10
		if s == i:
			l.append(i)
	if len(l) == len(arr):
		return True
	else:
		return False


def PalinArray(arr, n):
	c = 0
	for i in arr:
		a = i
		sum = 0
		rem = 0
		while i != 0:
			rem = i % 10
			sum = sum * 10 + rem
			i = i // 10
		if sum == a:
			c += 1
	if c == n:
		return True
	else:
		return False


def PalinArray(arr, n):
	arr = list(map(str, arr))
	for i in range(n):
		k = len(arr[i])
		for j in range(round(k / 2)):
			if arr[i][j] != arr[i][k - 1 - j]:
				return 0
	return 1


def PalinArray(arr, n):
	for i in range(len(arr)):
		prev = str(arr[i])
		new = prev[::-1]
		if new != prev:
			return 0
	return 1


def PalinArray(arr, n):
	l = []
	for i in arr:
		st = str(i)
		if st == st[::-1]:
			l.append(i)
		else:
			return 0
	if len(l) == 0:
		pass
	else:
		return 1


def PalinArray(arr, n):
	for i in range(n):
		num = arr[i]
		rev = 0
		while num != 0:
			digit = num % 10
			rev = rev * 10 + digit
			num = num // 10
		if rev != arr[i]:
			return 0
	return 1


def PalinArray(arr, n):
	c = 0
	for i in arr:
		i = str(i)
		if i == i[::-1]:
			c += 1
	if c == len(arr):
		return 1
	else:
		return 0


def PalinArray(arr, n):
	b = 0
	for i in arr:
		a = str(i)
		if a == a[::-1]:
			b += 1
	if b == len(arr):
		return 1
	return 0


def PalinArray(arr, n):
	for number in arr:
		digits = [i for i in str(number)]
		for i in range(0, int(len(digits) / 2)):
			if digits[i] != digits[len(digits) - 1 - i]:
				return False
	return True


def isPal(n):
	x = 0
	temp = n
	while n > 0:
		r = n % 10
		x = x * 10 + r
		n = n // 10
	if x == temp:
		return 1
	return 0

def PalinArray(arr, n):
	for i in arr:
		if isPal(i):
			continue
		else:
			return 0
	return 1


def PalinArray(arr, n):
	for v in arr:
		b = str(v)
		for i in range(len(b) // 2):
			if int(b[i]) ^ int(b[len(b) - 1 - i]):
				return 0
	return 1


def PalinArray(arr, n):
	b = list(map(lambda x: str(x), arr))
	for i in b:
		if i != i[::-1]:
			return 0
	return 1


def PalinArray(arr, n):
	for a in arr:
		a = str(a)
		if a != a[::-1]:
			return 0
	return 1


def PalinArray(arr, n):
	count = 0
	for m in arr:
		if m == reverse(m):
			count += 1
	if count == n:
		return 1
	else:
		return 0

def reverse(m):
	sum = 0
	while m != 0:
		d = m % 10
		sum = sum * 10 + d
		m = m // 10
	return sum


def PalinArray(arr, n):
	for i in arr:
		rev = 0
		n = i
		while n > 0:
			digit = n % 10
			rev = rev * 10 + digit
			n = n // 10
		if i == rev:
			isPalindrome = True
		else:
			isPalindrome = False
		if isPalindrome:
			continue
		else:
			return 0
	return 1


def ispal(s):
	n = len(s)
	i = 0
	e = n - 1
	while i < e:
		if s[i] == s[e]:
			i += 1
			e -= 1
		else:
			return False
	return True

def PalinArray(arr, n):
	for i in arr:
		s = str(i)
		if not ispal(s):
			return False
	return True


def is_palindrome(num):
	num_str = str(num)
	n = len(num_str)
	for i in range(int((n - 1) / 2) + 1):
		if num_str[i] != num_str[n - 1 - i]:
			return False
	return True

def PalinArray(arr, n):
	for i in range(0, len(arr)):
		if not is_palindrome(arr[i]):
			return 0
	return 1


def PalinArray(arr, n):
	digits = []
	for num in arr:
		while num != 0:
			digits.append(num % 10)
			num = num // 10
		if digits != digits[::-1]:
			return False
		digits.clear()
	return True


def PalinArray(arr, n):
	global i
	i = 0
	for x in arr:
		number = x
		revs_number = 0
		while number > 0:
			remainder = number % 10
			revs_number = revs_number * 10 + remainder
			number = number // 10
			if revs_number == x:
				i = i + 1
	if i == n:
		return 1
	else:
		return 0


def isPalindrome(N):
	str1 = '' + str(N)
	len1 = len(str1)
	for i in range(int(len1 / 2)):
		if str1[i] != str1[len1 - 1 - i]:
			return False
	return True

def PalinArray(arr, n):
	for i in range(n):
		ans = isPalindrome(arr[i])
		if ans == False:
			return False
	return True


def PalinArray(arr, n):
	for i in range(n):
		s = str(arr[i])
		a = int(s[::-1])
		if arr[i] != a:
			return 0
	return 1


def PalinArray(arr, n):
	lst = []
	for i in arr:
		num = str(i)
		rev_num = num[::-1]
		if num == rev_num:
			lst.append(num)
	if len(lst) == len(arr):
		return 1
	else:
		return 0


def PalinArray(arr, n):
	count = 0
	for (i, v) in enumerate(arr):
		l = 0
		x = 0
		while v > 0:
			x = v % 10
			l = l * 10 + x
			v = v // 10
			if l == arr[i]:
				count = count + 1
	if count == n:
		return 1


def PalinArray(arr, n):
	for num in arr:
		str1 = str(num)
		if str1 != str1[::-1]:
			return 0
	return 1


def ispal(i):
	sum = 0
	k = i
	while i != 0:
		rem = i % 10
		sum = sum * 10 + rem
		i = int(i / 10)
	if sum == k:
		return True
	else:
		return False

def PalinArray(arr, n):
	c = 0
	for i in arr:
		if ispal(i):
			c = c + 1
	if c == n:
		return 1
	else:
		return 0


def PalinArray(arr, n):
	fl = 0
	for k in arr:
		k = str(k)
		k2 = k[::-1]
		if k != k2:
			fl = 1
	if fl == 0:
		return 1
	else:
		return 0


def PalinArray(arr, n):
	for i in arr:
		orig = i
		rev = 0
		while i > 0:
			dig = i % 10
			rev = rev * 10 + dig
			i = i // 10
		if rev == orig:
			if arr.index(orig) == len(arr) - 1:
				return 1
			else:
				continue
		else:
			return 0
			break


def checkpal(s):
	if s == s[::-1]:
		return 1
	else:
		return 0

def PalinArray(arr, n):
	for i in range(n):
		s = str(arr[i])
		a = checkpal(s)
		if a == 1:
			continue
		else:
			return 0
	return 1


def PalinArray(arr, n):
	for num in arr:
		temp = num
		reverse = 0
		while temp > 0:
			remainder = temp % 10
			reverse = reverse * 10 + remainder
			temp = temp // 10
		if num != reverse:
			return 0
	return 1


def PalinArray(arr, n):
	return all((str(num) == str(num)[::-1] for num in arr))


def PalinArray(arr, n):
	flag = 1
	for i in arr:
		p = str(i)
		q = int(p[::-1])
		if i != q:
			flag = 0
	if flag == 0:
		return 0
	else:
		return 1


def PalinArray(arr, n):
	flag = False
	for i in arr:
		i = str(i)
		if i == i[::-1]:
			flag = True
		else:
			flag = False
			return 0
	if flag == True:
		return 1


def PalinArray(arr, n):
	for i in range(n):
		if solve(arr[i]) == False:
			return 0
	return 1

def solve(x):
	x = str(x)
	n = len(x)
	i = 0
	j = n - 1
	while i <= j:
		if x[i] != x[j]:
			return False
		i += 1
		j -= 1
	return True


def PalinArray(arr, n):
	for i in arr:
		d = i
		rev = 0
		while d > 0:
			rev = rev * 10 + d % 10
			d = d // 10
		if rev != i:
			return 0
	return 1


def PalinArray(arr, n):
	flag = 0
	for itemToCheck in arr:
		if str(itemToCheck) == str(itemToCheck)[::-1]:
			flag = 0
		else:
			flag = 1
			break
	if flag == 0:
		return 1
	else:
		return 0


def PalinArray(arr, n):
	val = True
	for i in arr:
		if str(i) == str(i)[::-1]:
			pass
		else:
			val = False
	return val


def PalinArray(arr, n):
	list1 = []
	for i in arr:
		i = str(i)
		if i == i[::-1]:
			list1.append(1)
		else:
			list1.append(0)
	for i in list(set(list1)):
		if i == 0:
			return False
		else:
			return True


def PalinArray(arr, n):
	palin = 1
	for num in arr:
		if str(num) != str(num)[::-1]:
			palin = 0
			break
	return palin


def is_palindrome(number):
	number = str(number)
	if number == number[::-1]:
		return True

def PalinArray(arr, n):
	l = []
	for i in arr:
		if is_palindrome(i):
			l.append(i)
	if len(arr) == len(l):
		return 1
	else:
		return 0


def PalinArray(arr, n):
	n = len(arr)
	i = 0
	value = 0
	while i < n:
		num = arr[i]
		digit = len(str(num))
		temp = num
		rev = 0
		for j in range(digit):
			rem = temp % 10
			rev = rem + rev * 10
			temp = temp // 10
		if rev == num:
			value = value + 1
		i = i + 1
	if value == n:
		return 1
	else:
		return 0


def PalinArray(arr, n):
	for num in arr:
		orig_num = num
		sum = 0
		while num > 0:
			temp = num % 10
			num = num // 10
			sum = sum * 10 + temp
		if orig_num != sum:
			return False
	return True


def PalinArray(arr, n):
	for num in arr:
		l_num = str(num)
		r_num = l_num[::-1]
		if l_num != r_num:
			return 0
	return 1


def PalinArray(arr, n):
	for i in range(n):
		var = str(arr[i])
		if var == var[::-1]:
			continue
		else:
			return 0
	return 1


def PalinArray(arr, n):
	bool = True
	for i in range(n):
		if str(arr[i]) == str(arr[i])[::-1]:
			bool = True
		else:
			bool = False
			break
	return bool


def PalinArray(arr, n):
	result = 0
	count = 0
	for i in range(n):
		ele_str = str(arr[i])
		reverse = ele_str[::-1]
		if ele_str != reverse:
			count = count + 1
	if count == 0:
		result = 1
	return result


def PalinArray(arr, n):
	result = True
	for i in arr:
		j = str(i)
		if j != j[::-1]:
			return 0
	return 1