Given two positive integers num1 and num2, subtract num2 from num1 on a 12 hour clock rather than a number line.
Note: Assume the Clock starts from 0 hour to 11 hours.
 
Example 1:
Input:
num1 = 7, num2 = 5
Output:
2
Explanation:
7-5 = 2. The time in a 12 hour clock is 2.
Example 2:
Input:
num1 = 5, num2 = 7
Output:
10
Explanation:
5-7 = -2. The time in a 12 hour clock is 10.
 
Your Task:
You don't need to read input or print anything. Your task is to complete the function subClock() which takes 2 Integers num1, and num2 as input and returns the required time in a 12 hour clock format.
 
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
 
Constraints:
1 <= num1,num2 <= 10^{3}

Difficulty: EASY
Tags: Number theory
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3



class Solution:

    def subClock(self, num1, num2):

        # code here

Solutions:
class Solution:

	def subClock(self, num1, num2):
		return (num1 - num2) % 12


class Solution:

	def subClock(self, num1, num2):
		sub = (num1 - num2) % 12
		if sub >= 0:
			return sub
		else:
			return sub + 12


class Solution:

	def subClock(self, num1, num2):
		sub1 = num1 - num2
		if sub1 > 0 or sub1 < -12:
			return sub1 % 12
		elif sub1 == 0:
			return sub1
		return 12 + sub1


class Solution:

	def subClock(self, num1, num2):
		if num1 > 12:
			num1 %= 12
		if num2 > 12:
			num2 %= 12
		time = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
		return time[num1 - num2]


class Solution:

	def subClock(self, num1, num2):
		ans = num1 - num2
		ans %= 12
		if ans < 0:
			ans += 12
		return ans


class Solution:

	def subClock(self, num1, num2):
		x = num1 - num2
		y = x % 12
		return y


class Solution:

	def subClock(self, num1, num2):
		t1 = 0
		t = num1 - num2
		if t == -12 or t == 12 or t == 0 or (t == 24) or (t == -24):
			return 0
		elif t < 12 and t > 0:
			return t
		elif t < 0:
			t1 = t % 12
			if t1 < 0:
				return t1 + 12
			return t1
		elif t > 12:
			t1 = t % 12
			if t1 < 0:
				return t1 + 12
			return t1


class Solution:

	def subClock(self, num1, num2):
		return int(abs((num1 - num2) % 12))


class Solution:

	def subClock(self, num1, num2):
		num1 = num1 % 12
		num2 = num2 % 12
		difference = num1 - num2
		if difference < 0:
			return 12 + difference
		return difference


class Solution:

	def subClock(self, num1, num2):
		diff = num1 - num2
		diff = diff % 12
		if diff < 0:
			diff = 12 + diff
		return diff


class Solution:

	def subClock(self, num1, num2):
		time = num1 - num2
		while time >= 12 or time < 0:
			if time < 0:
				time += 12
			else:
				time -= 12
		return time


class Solution:

	def subClock(self, num1, num2):
		if num1 >= num2:
			return (num1 - num2) % 12
		else:
			return (12 - abs(num2 - num1)) % 12


class Solution:

	def subClock(self, num1, num2):
		x = (num1 - num2) // 12
		if (num1 - num2) % 12 == 0:
			return 0
		elif num1 - num2 < 0:
			return num1 - num2 - 12 * x
		elif num1 - num2 > 0 and num1 - num2 < 12:
			return num1 - num2
		elif num1 - num2 > 12 * x:
			return num1 - num2 - 12 * x


class Solution:

	def subClock(self, num1, num2):
		if num1 - num2 >= 0 or (num1 - num2) % 12 == 0:
			return (num1 - num2) % 12
		return 12 - abs(num1 - num2) % 12


class Solution:

	def subClock(self, num1, num2):
		num = num1 - num2
		i = 12
		if num >= 12:
			i = num // i
			return num - 12 * i
		elif num < 0:
			i = num // i + 1
			num = num - 12 * i
			return 12 + num
		return num


class Solution:

	def subClock(self, num1, num2):
		res = num1 - num2
		if res <= 11 and res >= 0:
			return res
		elif res < 0 and res >= -11:
			res2 = res + 12
			return res2
		elif res > 11 or res < -11:
			res3 = res % 12
			return res3


class Solution:

	def subClock(self, num1, num2):
		ans = num1 - num2
		while ans >= 12:
			ans = ans - 12
		while ans < 0:
			ans = ans + 12
		return ans


class Solution:

	def subClock(self, num1, num2):
		while num1 > 11:
			num1 = num1 - 12
		while num2 > 12:
			num2 = num2 - 12
		a = num1 - num2
		if a >= 0:
			if a > 12:
				return a % 12
			return a
		else:
			return 12 + a


class Solution:

	def subClock(self, num1, num2):
		sum = num1 - num2
		if sum % 12 == 0:
			return 0
		elif sum < 0:
			return sum % 12
		elif sum > 12:
			return sum % 12
		else:
			return sum


class Solution:

	def subClock(self, num1, num2):
		if num1 - num2 == 12 or num1 - num2 == 24:
			return '0'
		elif num1 - num2 > 0 and num1 - num2 < 12:
			return num1 - num2
		elif num1 - num2 < 0 and num1 - num2 > -12:
			return 12 + (num1 - num2)
		elif num1 - num2 > 12:
			return (num1 - num2) % 12
		elif num1 - num2 < 0 and num1 - num2 < -12:
			b = (num1 - num2) % 12
			return b
		else:
			return '0'


class Solution:

	def subClock(self, num1, num2):
		(int(num1), num2)
		sub = (num1 - num2) % 12
		return sub


class Solution:

	def subClock(self, num1, num2):
		if num1 - num2 < 0:
			return (num1 - num2) % 12
		elif num1 - num2 <= 11:
			return num1 - num2
		elif num1 - num2 == 12:
			return 0
		return (num1 - num2) % 12


class Solution:

	def subClock(self, num1, num2):
		x = num1 - num2
		if '-' in str(x):
			return (12 + x) % 12
		else:
			return x % 12


class Solution:

	def subClock(self, num1, num2):
		x = num1 - num2
		if abs(x) % 12 == 0:
			return 0
		elif x < 0:
			return 12 - abs(x) % 12
		else:
			return x % 12