Company: Codenation_23june
Difficulty: medium
Cryptarithm Problem Description A cryptarithm is a mathematical puzzle where the goal is to find the correspondence between letters and digits such that the given arithmetic equation consisting of letters holds true. Given a cryptarithm as an array of strings crypt , count the number of its valid solutions. The solution is valid if each letter represents a different digit, and the leading digit of any multi-digit number is not zero. crypt has the following structure: [word1, word2, word3] , which stands for word1 + word2 = word3 cryptarithm. Examples Example 1: Input: crypt = ["SEND", "MORE", "MONEY"] Output: 1 Explanation: Because there is only one solution to this cryptarithm: O = 0, M = 1, Y = 2, E = 5, N = 6, D = 7, R = 8, and S = 9 (9567 + 1085 = 10652). Example 2: Input: crypt = ["GREEN", "BLUE", "BLACK"] Output: 12 Explanation: Because there are 12 possible valid solutions: 54889 + 6138 = 61027 18559 + 2075 = 20634 72449 + 8064 = 80513 48229 + 5372 = 53601 47119 + 5261 = 52380 3