Company: Trilogy_4july
Difficulty: medium
Cryptarithm Problem Description A cryptarithm is a letter-substitution puzzle: each distinct letter stands for a single digit, and the puzzle is solved by finding assignments of digits to letters that make the written-out addition true. You are given the puzzle as an array of strings crypt . Determine how many different digit assignments satisfy it. An assignment counts as valid only when every letter maps to a distinct digit, and no multi-digit word ends up with a leading zero. crypt is always structured as [word1, word2, word3] , representing the equation word1 + word2 = word3 . Examples Example 1: Input: crypt = ["SEND", "MORE", "MONEY"] Output: 1 Explanation: Exactly one digit assignment satisfies this puzzle: O = 0, M = 1, Y = 2, E = 5, N = 6, D = 7, R = 8, and S = 9 (giving 9567 + 1085 = 10652). Example 2: Input: crypt = ["GREEN", "BLUE", "BLACK"] Output: 12 Explanation: Twelve distinct digit assignments make this equation hold: 34889 + 6138 = 41027 18559 + 2075 = 20634 72449 + 8