Given a floating point number in string format s, check whether it is even or odd.
 
Example 1:
Input: 
n = 4
s = 97.8
Output: EVEN
Explanation: 8 is even number.
Example 2: 
Input:
n = 6
s = 100.70
Output: ODD
Explanation: Trailing 0s after dot do not matter.
Your Task:  
You don't need to read input or print anything. Your task is to complete the function isEven() which accepts a string s(floating point number) and the integer n(denotes the length of the string s) as input parameter and returns a boolean value.
 
Expected Time Complexity: O(n)
Expected Auxiliary Space: O(1)
 
Constraints:
1 <= n <= 10^{5}
n is the length of the string s.^{ }

Source: geeksforgeeks | Difficulty: EASY
Tags: String algorithms

Data structures

Starter code: #User function Template for python3

class Solution:

    def isEven(self, s, n):
        # code here

Solutions:
class Solution:

	def isEven(self, s, n):
		s = s.split('.')
		S = s[1]
		S = S.replace('0', '')
		if len(S) == 0:
			if int(s[0]) % 2 == 0:
				return True
			return False
		S = int(S)
		if S % 2 == 0:
			return True
		return False


class Solution:

	def isEven(self, s, n):
		st = s.split('.')[1]
		st = st.replace('0', '')
		if st == '':
			if int(s.split('.')[0]) % 2 == 0:
				return 1
			else:
				return 0
		else:
			st = int(st)
			if st % 2 == 0:
				return 1
			else:
				return 0


class Solution:

	def isEven(self, s, n):
		a = ''
		for i in range(n - 1, -1, -1):
			if s[i] != '0' and s[i] != '.':
				a = a + s[i]
		b = a[::-1]
		if int(b) % 2 == 0:
			return 1
		return 0


class Solution:

	def isEven(self, s, n):
		for i in reversed(range(len(s))):
			if s[i] != '0' and s[i] != '.':
				ans = s[i]
				break
		if int(ans) % 2 == 0:
			return 1
		return 0


class Solution:

	def isEven(self, s, n):
		s = str(s)
		for i in s[::-1]:
			if i != '0' and i != '.':
				if int(i) % 2 == 0:
					return True
				else:
					return False


class Solution:

	def isEven(self, s, n):
		l = len(s)
		dotSeen = False
		for i in range(l - 1, -1, -1):
			if s[i] == '0' and dotSeen == False:
				continue
			if s[i] == '.':
				dotSeen = True
				continue
			if int(s[i]) % 2 == 0:
				return True
			return False


class Solution:

	def isEven(self, s, n):
		i = n - 1
		num = ''
		while s[i] != '.':
			if s[i] != '0':
				num = s[i] + num
			i -= 1
		if num == '':
			num = s[0:i]
		if int(num) % 2 == 1:
			return False
		else:
			return True


class Solution:

	def isEven(self, s, n):
		stack = [*s]
		while stack and (stack[-1] == '0' or stack[-1] == '.'):
			stack.pop()
		return int(stack[-1]) % 2 == 0


class Solution:

	def isEven(self, s, n):
		m = ''
		zero = False
		for i in s:
			if i == '.':
				zero = True
				pass
			elif i != '0':
				m += i
			elif not zero:
				m += i
		m = int(m)
		return m % 2 == 0


class Solution:

	def isEven(self, s, n):
		s = s.split('.')
		s1 = s[1].replace('0', '')
		try:
			return int(s1) % 2 == 0
		except:
			return int(s[0]) % 2 == 0


class Solution:

	def isEven(self, s, n):
		res = ''
		for i in range(n - 1, -1, -1):
			if s[i] != '0' and s[i] != '.':
				return 1 if int(s[i]) % 2 == 0 else 0


class Solution:

	def isEven(self, s, n):
		s1 = s[::-1]
		a = ''
		for i in s1:
			if i != '0' and i != '.' and (int(i) % 2 == 0):
				return 1
			elif i != '0' and i != '.' and (int(i) % 2 != 0):
				return 0


class Solution:

	def isEven(self, s, n):
		decimal = False
		for i in range(len(s) - 1, -1, -1):
			if s[i] == '0' and decimal == False:
				continue
			if s[i] == '.':
				decimal = True
				continue
			return True if int(s[i]) % 2 == 0 else False


class Solution:

	def isEven(self, s, n):
		a = s[::-1]
		for i in range(n):
			if a[i] == '.':
				continue
			elif a[i] == '0':
				continue
			elif int(a[i]) % 2 == 0 and a[i] != '0':
				return True
			else:
				return False


class Solution:

	def isEven(self, s, n):
		for i in s[::-1]:
			if i == '0' or i == '.':
				pass
			elif int(i) % 2 == 0:
				return True
				break
			else:
				return False
				break


class Solution:

	def isEven(self, s, n):
		po = s.index('.')
		str = s[po + 1:n]
		eo = ''
		for i in range(len(str) - 1, -1, -1):
			if str[i] == '0':
				if eo != '':
					eo += str[i]
			else:
				eo += str[i]
		if eo == '':
			return True if int(s[:po]) % 2 == 0 else False
		elif int(eo[::-1]) % 2 == 0:
			return True
		else:
			return False


class Solution:

	def isEven(self, s, n):
		s = s.split('.')
		a = s[0]
		b = s[1]
		t = ''
		for i in b:
			if i == '0':
				pass
			else:
				t += i
		r = a + t
		if int(r) % 2 == 0:
			return 1
		return 0


class Solution:

	def isEven(self, s, n):
		n = -1
		if float(s) == 0.0:
			return True
		j = -1
		while True:
			if s[j] != '0' and s[j] != '.':
				if int(s[j]) % 2:
					return False
				return True
			j -= 1


class Solution:

	def isEven(self, s, n):
		for i in range(n):
			if s[i] == '.':
				a = int(s[i + 1:n + 1])
				b = int(s[0:i])
				break
		n = a
		while n > 0:
			temp = n % 10
			if temp == 0:
				n = int(n / 10)
			else:
				break
		if n:
			if n % 2 == 0:
				return True
		elif b % 2 == 0:
			return True
		elif b % 2 != 0:
			return False


class Solution:

	def isEven(self, s, n):
		s1 = s.rstrip('0')
		return int(s1[-2]) % 2 == 0 if s1[-1] == '.' else int(s1[-1]) % 2 == 0


class Solution:

	def isEven(self, s, n):
		i = 1
		while i <= n:
			if s[-1 * i] == '0' or s[-1 * i] == '.':
				i += 1
				continue
			elif int(s[-1 * i]) % 2 == 0:
				return True
			else:
				return False
		return False


class Solution:

	def isEven(self, s, n):
		count = 0
		flag = False
		for i in range(len(s) - 1, -1, -1):
			if flag == False and s[i] == '0':
				continue
			if s[i] == '.':
				flag = True
				continue
			num = int(s[i])
			if num % 2 == 0:
				return True
			return False
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		n = int(input().strip())
		s = input().strip()
		solObj = Solution()
		ans = solObj.isEven(s, n)
		if ans:
			print('EVEN')
		else:
			print('ODD')


class Solution:

	def isEven(self, s, n):
		for itr in range(n):
			if s[-1 * (1 + itr)] == '.':
				continue
			if int(s[-1 * (itr + 1)]) != 0:
				if int(s[-1 * (itr + 1)]) % 2 == 0:
					return True
				else:
					return False
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		n = int(input().strip())
		s = input().strip()
		solObj = Solution()
		ans = solObj.isEven(s, n)
		if ans:
			print('EVEN')
		else:
			print('ODD')


class Solution:

	def isEven(self, s, n):
		s = s.split('.')
		l = []
		if int(s[1]) == 0:
			if int(s[0]) % 2 == 0:
				return True
			else:
				return False
		else:
			for i in s[1]:
				if i != '0':
					l.append(i)
			if int(l[-1]) % 2 == 0:
				return True
			else:
				return False


class Solution:

	def isEven(self, s, n):
		li = s.split('.')
		S = li[-1]
		S = S[::-1]
		S = int(S)
		if S == 0:
			S2 = int(li[0])
			if S2 % 2 != 0:
				return False
			else:
				True
		S = str(S)
		if int(S[0]) % 2 != 0:
			return False
		return True


class Solution:

	def isEven(self, s, n):
		ans = ''
		dot = False
		for ch in s:
			if ch == '0' and dot == False:
				ans += ch
			elif ch.isnumeric() and ch != '0':
				ans += ch
			elif ch == '.':
				dot = True
		if int(ans) % 2 == 0:
			return True
		else:
			return False


import math

class Solution:

	def isEven(self, s, n):
		s1 = s
		s = list(s)
		a = '.'
		b = ''
		for i in range(n):
			if s[i] >= '1' and s[i] <= '9':
				b += s[i]
		c = b[len(b) - 1]
		if int(c) % 2 == 0:
			return 1
		return 0


class Solution:

	def isEven(self, s, n):
		a = s[s.find('.') + 1:n]
		b = a.replace('0', '')
		if len(b) == 0:
			if int(s[0:s.find('.')]) % 2 == 0:
				return 1
			else:
				return 0
		if int(b) % 2 == 0:
			return 1
		else:
			return 0


class Solution:

	def isEven(self, s, n):
		if '.' not in s:
			if int(s) % 2 == 0:
				return 1
			return 0
		s = s.split('.')
		for i in range(len(s[1]) - 1, -1, -1):
			if s[1][i] != '0':
				if int(s[1][i]) % 2 == 0:
					return 1
				return 0
			if i == 0:
				break
		for i in range(len(s[0]) - 1, -1, -1):
			if s[0][i] != '0':
				if int(s[0][i]) % 2 == 0:
					return 1
				return 0
			if i == 0:
				return 1


class Solution:

	def isEven(self, s, n):
		for i in range(n - 1, -1, -1):
			if s[i].isdigit():
				if int(s[i]) == 0:
					continue
				elif int(s[i]) % 2 == 0:
					return True
				else:
					return False
			else:
				break
		for j in range(i - 1, -1, -1):
			if int(s[j]) % 2 == 0:
				return True
			else:
				return False


class Solution:

	def isEven(self, s, n):
		b = []
		c = []
		e = ''
		a = s.index('.')
		for i in range(0, a):
			b.append(s[i])
		for i in range(n - 1, a, -1):
			if s[i] == '0' and len(c) != 0:
				c.append(s[i])
			elif s[i] != '0':
				c.append(s[i])
		for i in range(len(c) - 1, -1, -1):
			b.append(c[i])
		for i in b:
			e += i
		f = int(e)
		if f % 2 == 0:
			return 1
		else:
			return 0


class Solution:

	def isEven(self, s, n):
		i = 0
		ans = 0
		while n - 1 > i:
			if s[n - 1] != '.' and s[n - 1] != '0':
				ans = s[n - 1]
				break
			n -= 1
		if int(ans) % 2 == 0:
			return True
		else:
			return False


class Solution:

	def isEven(self, s, n):
		s1 = s.split('.')[-1].rstrip('0')
		if len(s1) > 0:
			return int(s1) % 2 == 0
		return int(s.split('.')[0]) % 2 == 0


class Solution:

	def isEven(self, s, n):
		s = s.split('.')
		count = 0
		if int(s[-1]) == 0:
			if int(s[0]) % 2 == 0:
				return True
			else:
				return False
		for i in s[-1][::-1]:
			if i == '0':
				pass
			elif int(i) % 2 == 0:
				return True
			else:
				return False