![]() |
VOOZH | about |
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 hours to 11 hours.
Examples:
Input: Num1 = 3, Num2 = 7
Output: 9
Explanation: 3*7 = 21. The time in a 12 hour clock is 9.Input: Num1 = 3, Num2 = 4
Output: 0
Approach: Follow the steps to solve this problem:
Note: You can skip all the steps and return (Num1*Num2) % 12 also, it also works fine.
Below is the implementation of the above approach.
9
Time Complexity: O(1)
Auxiliary Space: O(1)