Given a big positive number x represented as string, find value of x % 11 or x mod 11. Output is expected as an integer.
Example 1:
Input: x = 1345
Output: 3
Explanation: 1345 % 11 = 3 
Example 1:
Input: x = 231456786543567898765
Output: 1
Explanation: 231456786543567898765 % 11 = 1
Your Task:  
You don't need to read input or print anything. Your task is to complete the function xmod11() which takes string x as the input parameter and returns the integer value of x%11.
Expected Time Complexity: O(length of string x)
Expected Space Complexity: O(1)
Constraints:
1 ≤ length of string x ≤ 100000

Difficulty: EASY
Tags: Number theory

Mathematics
Expected Time Complexity: O(length of string x)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3





class Solution:

    def xmod11(self,x):

        #code here

Solutions:
class Solution:

	def xmod11(self, x):
		a = int(x)
		return a % 11


class Solution:

	def xmod11(self, x):
		t = int(x)
		return t % 11


class Solution:

	def xmod11(self, x):
		ans = int(x)
		return ans % 11


class Solution:

	def xmod11(self, x):
		n = len(x)
		sum = 0
		for i in range(n - 1, -1, -1):
			digit = int(x[i])
			if (n - i) % 2 == 0:
				sum = (sum - digit + 11) % 11
			else:
				sum = (sum + digit) % 11
		return sum


class Solution:

	def xmod11(self, x):
		valu = int(x)
		return valu % 11


import math

class Solution:

	def xmod11(self, x):
		a = int(x)
		return a % 11


class Solution:

	def xmod11(self, x: str) -> int:
		n = len(x)
		remainder = 0
		for i in range(n):
			digit = int(x[i])
			remainder = (remainder * 10 + digit) % 11
		return remainder


class Solution:

	def xmod11(self, x):
		remain = int(x)
		return remain % 11


class Solution:

	def xmod11(self, x):
		value = int(x)
		return value % 11


class Solution:

	def xmod11(self, x):
		x = int(x)
		y = x % 11
		return y


class Solution:

	def xmod11(self, x):
		A = int(x)
		return A % 11


class Solution:

	def xmod11(self, x):
		val = int(x)
		return val % 11


class Solution:

	def xmod11(self, x):
		num = int(x)
		return num % 11


class Solution:

	def xmod11(self, x):
		return int(x) % 11
		c1 = c2 = 0
		for i in range(len(x)):
			if i % 2 == 0:
				c1 = c1 + int(x[i])
			else:
				c2 = c2 + int(x[i])
		c = abs(c1 - c2)
		return c % 11


class Solution:

	def xmod11(self, x):
		y = 0
		for i in range(0, len(x)):
			y = (10 * y + int(x[i])) % 11
		return y


class Solution:

	def xmod11(self, x):
		v = int(x)
		return v % 11


class Solution:

	def xmod11(self, x):
		from math import floor
		return floor(int(x) % 11)


class Solution:

	def xmod11(self, x):
		s = int(x) % 11
		return s


class Solution:

	def xmod11(self, x):
		p = int(x)
		return p % 11


class Solution:

	def xmod11(self, x):
		l = len(x)
		num = 0
		rem = 0
		for i in range(0, len(x)):
			num = rem * 10 + int(x[i])
			rem = num % 11
		return rem


class Solution:

	def xmod11(self, x):
		f = int(x) % 11
		return f


class Solution:

	def xmod11(self, x):
		self.x = int(x)
		self.res = self.x % 11
		return self.res


class Solution:

	def xmod11(self, x):
		z = int(x)
		return z % 11


class Solution:

	def xmod11(self, x):
		X = int(x)
		return X % 11


class Solution:

	def xmod11(self, x):
		c1 = 0
		c2 = 0
		for i in range(len(x)):
			c2 = c1 * 10 + int(x[i])
			c1 = c2 % 11
		return c1


class Solution:

	def xmod11(self, x):
		n = len(x)
		p = x[0::2]
		q = x[1::2]
		a = 0
		b = 0
		for i in p:
			a += int(i)
		for i in q:
			b += int(i)
		c = a - b
		if c < 0 and n % 2 == 1:
			c = abs(c)
			return int((11 - int(c % 11)) % 11)
		elif c < 0 and n % 2 == 0:
			c = abs(c)
			return int(c % 11)
		elif n % 2 == 0:
			return int((11 - int(c % 11)) % 11)
		else:
			return int(c % 11)


import sys

class Solution:

	def xmod11(self, x):
		x = int(x)
		return x % 11


class Solution:

	def xmod11(self, x):
		sum_mod11 = 0
		for k in range(len(x)):
			idx = len(x) - 1 - k
			digit = int(x[idx])
			if k % 2 == 0:
				sum_mod11 += digit
			else:
				sum_mod11 += 11 - digit
			sum_mod11 %= 11
		return sum_mod11


class Solution:

	def xmod11(self, x):
		ret = sum(map(int, x[::-1][0::2])) - sum(map(int, x[::-1][1::2]))
		if ret >= 11:
			ret %= 11
		elif ret < 0:
			while ret < 0:
				ret += 11
		return ret


class Solution:

	def xmod11(self, x):
		x1 = int(x)
		return x1 % 11


class Solution:

	def xmod11(self, x):
		converted_num = int(x)
		return converted_num % 11


class Solution:

	def xmod11(self, x):
		n = int(x)
		return n % 11


import math

class Solution:

	def xmod11(self, x):
		odd = 0
		even = 0
		n = len(x)
		for i in range(n):
			if i % 2 == 0:
				odd += int(x[i])
			else:
				even += int(x[i])
		if n % 2 == 0:
			diff = even - odd
		else:
			diff = odd - even
		return int(x) % 11


class Solution:

	def xmod11(self, x):
		k = int(x)
		return k % 11


class Solution:

	def xmod11(self, x):
		i = int(x)
		return i % 11