Company: Trilogy_7aug
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 . Examples Example 1: Input: crypt = ["SEND", "MORE", "MONEY"] Output: 1 Explanation: Because there is only one solution to this cryptarithm: S = 9, E = 5, N = 6, D = 7, M = 1, O = 0, R = 8, Y = 2 (9567 + 1085 = 10652). Example 2: Input: crypt = ["GREEN", "BLUE", "BLACK"] Output: 12 Explanation: There are 12 possible valid solutions for this cryptarithm (e.g., one solution is G=2, R=0, E=6, N=7, B=1, L=5, U=4, A=3, C=8, K=9, where 20667 + 1546 = 22213). Example 3