A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward. Examples of numerical palindromes are: 

2332
110011
54322345

For this kata, single digit numbers will not be considered numerical palindromes. 

For a given number ```num```, write a function to test if the number contains a numerical palindrome or not and return a boolean (true if it does and false if does not). Return "Not valid" if the input is not an integer or is less than 0. 

Note: Palindromes should be found without permutating ```num```. 

```
palindrome(5) => false
palindrome(1221) => true
palindrome(141221001) => true
palindrome(1215) => true 
palindrome(1294) => false 
palindrome("109982") => "Not valid"
```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def palindrome(num):
	

Solutions:
def palindrome(num):
	if type(num) != int or num < 0:
		return 'Not valid'
	s = str(num)
	for i in range(len(s) - 2):
		if s[i] == s[i + 1] or s[i] == s[i + 2]:
			return True
	return len(s) != 1 and s[-1] == s[-2]


def palindrome(num):
	return 'Not valid' if type(num) != int or num < 0 else bool(__import__('re').search('(\\d).?\\1', str(num)))


def palindrome(num):
	if type(123) != type(num):
		return 'Not valid'
	n = str(num)
	if any((not c.isdigit() for c in n)):
		return 'Not valid'
	l = len(n)
	return any((n[i] == n[i + 1] for i in range(l - 1))) or any((n[i] == n[i + 2] for i in range(l - 2)))


import re

def palindrome(num):
	return re.search('(\\d)\\d?\\1', str(num)) is not None if isinstance(num, int) and num > 0 else 'Not valid'


def palindrome(num):
	if not isinstance(num, int) or num < 0:
		return 'Not valid'
	s = str(num) + '%'
	for i in range(len(s) - 2):
		if s[i] == s[i + 1] or s[i] == s[i + 2]:
			return True
	return False


def palindrome(n):
	if not isinstance(n, int) or n < 0:
		return 'Not valid'
	s = f'{n}'
	return any((n in s[i:i + 2] for (i, n) in enumerate(s[:-1], 1)))


import re

def palindrome(num):
	if not (isinstance(num, int) and num > 0):
		return 'Not valid'
	return bool(re.search('(.)\\1|(.).\\2', str(num)))


def palindrome(n):
	return 'Not valid' if type(n) != int or n < 0 else any((s == s[::-1] for s in subs(str(n))))

def subs(s):
	return [s[i:i + j] for j in range(2, len(s) + 1) for i in range(len(s) - j + 1)]


def palindrome(n):
	if type(n) is not int or n < 0:
		return 'Not valid'
	patterns = [2 * str(i) for i in range(10)] + [str(i) + str(j) + str(i) for j in range(10) for i in range(10)]
	for p in patterns:
		if p in str(n):
			return True
	return False