Given a one/two-digit timing, calculate the possibilities of occurrence of other timings(including the glowing one) with relevant to glowing segments, assuming some segments may not be glowing.
Displaying the numbers is done using a seven-segment display. It is guaranteed that the sticks currently displaying are working fine.
Example 1:
Input:
S = "78"
Output:
5
Explanation:
7 can be replaced by 
5 different numbers 
9, 3, 8, 0, and 7
(if none of the segment 
is broken) and 8 can be 
replaced by only 1 
number i.e 8 itself
(if none of the the 
segment is broken), 
therefore the answer 
is 5*1=5.
 
 
Example 2:
Input:
S = "05"
Output:
8
Explanation:
0 can be replaced by 
2 numbers, 8 and 0,
while 5 can be replaced
by 4 different numbers.
So, the answer is 4*2=8.
 
Your Task:
You don't need to read input or print anything. Your task is to complete the function numberOfPossibleTimings() which takes a string S and return number of possible timings.
 
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
 
 
Constraints:
0<=x<=99
Note:  The number x should contain 2 digits like 1 should be written as 01.

Source: geeksforgeeks | Difficulty: EASY

Starter code: #User function Template for python3
class Solution:
    def numberOfPossibleTimings (self,S):
        # code here 

Solutions:
class Solution:

	def numberOfPossibleTimings(self, S):
		a = [2, 7, 2, 3, 3, 4, 2, 5, 1, 2]
		x = a[int(S[0])]
		y = a[int(S[1])]
		return x * y


class Solution:

	def numberOfPossibleTimings(self, S):
		Check = {0: 2, 1: 7, 2: 2, 3: 3, 4: 3, 5: 4, 6: 2, 7: 5, 8: 1, 9: 2}
		ans = Check[int(S) // 10] * Check[int(S) % 10]
		return ans


class Solution:

	def numberOfPossibleTimings(self, S):
		l = [[1, 2, 3, 4, 5, 6], [2, 3], [1, 2, 7, 5, 4], [1, 2, 7, 3, 4], [6, 7, 2, 3], [1, 6, 7, 3, 4], [1, 6, 5, 4, 3, 7], [1, 2, 3], [1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 6, 7]]
		t = 1
		for i in S:
			c = 0
			for j in range(0, 10):
				if set(l[int(i)]) == set(l[int(i)]) & set(l[j]):
					c += 1
			t *= c
		return t


class Solution:

	def numberOfPossibleTimings(self, S):
		arr = list(S)
		sum = 1
		for i in arr:
			i = int(i)
			if i == 0 or i == 2 or i == 6 or (i == 9):
				sum *= 2
			if i == 3 or i == 4:
				sum *= 3
			if i == 1:
				sum *= 7
			if i == 5:
				sum *= 4
			if i == 7:
				sum *= 5
			if i == 8:
				sum *= 1
		return sum