Given two positive integers num1 and num2, the task is to find the product of the two numbers 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 = 2, num2 = 3
Output:
6
Explanation:
2*3 = 6. The time in a 12 hour clock is 6.
Example 2:
Input:
num1 = 3, num2 = 5
Output:
3
Explanation:
3*5 = 15. The time in a 12 hour clock is 3.
 
Your Task:
You don't need to read input or print anything. Your task is to complete the function mulClock() 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}

Source: geeksforgeeks | Difficulty: EASY
Tags: Number theory

Starter code: #User function Template for python3



class Solution:

    def mulClock(self, num1, num2):

        # code here

Solutions:
class Solution:

	def mulClock(self, num1, num2):
		mul = num1 * num2 % 12
		if mul >= 0:
			return mul
		else:
			return mul + 12


class Solution:

	def mulClock(self, num1, num2):
		return num1 * num2 % 12


class Solution:

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


class Solution:

	def mulClock(self, num1, num2):
		if num1 * num2 > 11:
			return int(num1 * num2) % 12
		else:
			return int(num1 * num2)


class Solution:

	def mulClock(self, num1, num2):
		pdt = num1 * num2
		ans = pdt % 12
		return ans


class Solution:

	def mulClock(self, num1, num2):
		val = num1 * num2
		if val < 12:
			return val
		elif val == 0 or val == 12:
			return 0
		else:
			return val % 12


class Solution:

	def mulClock(self, num1, num2):
		clock_time = num1 * num2
		if clock_time >= 12:
			b = clock_time % 12
			return b
		else:
			return clock_time


class Solution:

	def mulClock(self, num1, num2):
		t = num1 * num2
		if t > 12:
			t1 = t % 12
			if t1 < 12:
				return t1
				print(35 // 12)
		elif t == 12 or t == 24:
			return 0
		else:
			return t


class Solution:

	def mulClock(self, num1, num2):
		num = num1 * num2
		if num != 0 and num >= 12:
			return num % 12
		else:
			return num


class Solution:

	def mulClock(self, num1, num2):
		c = num1 * num2
		if c < 12:
			return c
		elif c == 1:
			return 0
		else:
			return c % 12


class Solution:

	def mulClock(self, num1, num2):
		ans = 1
		ans = num1 * num2 % 12
		return ans


class Solution:

	def mulClock(self, num1, num2):
		num = num1 * num2
		x = num % 12
		if num < 12:
			return num
		else:
			return x


class Solution:

	def mulClock(self, num1, num2):
		x = num1 * num2
		if x < 12:
			return x
		return x % 12


class Solution:

	def mulClock(self, num1, num2):
		num = num1 * num2
		i = 12
		if num >= 12:
			i = num // i
			return num - 12 * i
		return num


class Solution:

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


class Solution:

	def mulClock(self, num1, num2):
		multiply = num1 * num2
		if multiply == 12:
			return 0
		elif multiply > 12:
			return multiply % 12
		else:
			return multiply


class Solution:

	def mulClock(self, num1, num2):
		prod = num1 * num2
		if prod >= 12:
			prod %= 12
		return prod


class Solution:

	def mulClock(self, num1, num2):
		product = num1 * num2
		if product >= 12:
			return product % 12
		else:
			return product


class Solution:

	def mulClock(self, num1, num2):
		ans = num1 * num2
		ans1 = ans % 12
		return ans1


class Solution:

	def mulClock(self, num1, num2):
		if num1 * num2 > 24:
			return num1 * num2 % 12
		elif num1 * num2 < 24 and num1 * num2 > 12:
			return num1 * num2 - 12
		elif num1 * num2 < 12:
			return num1 * num2
		elif num1 * num2 == 24:
			return '0'
		else:
			return '0'


class Solution:

	def mulClock(self, num1, num2):
		num1 = int(num1)
		num2 = int(num2)
		product = num1 * num2 % 12
		return product


class Solution:

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


class Solution:

	def mulClock(self, num1, num2):
		c = num1 * num2
		if c < 12:
			return c
		else:
			c = c % 12
			return c


class Solution:

	def mulClock(self, num1, num2):
		mul = num1 * num2
		if 12 > mul:
			return mul
		if 12 <= mul:
			return mul % 12


class Solution:

	def mulClock(self, a, b):
		return a * b % 12