Company: Trilogy_8aug
Difficulty: medium
Cryptarithmetic Puzzle 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: [word_1, word_2, sum_word] , which corresponds to the word_1 + word_2 == sum_word cryptarithm. Examples Example 1: Input: crypt = ["TEN", "ONE", "TWO"] Output: 1 Explanation: Because there is only one solution to this cryptarithm: T = 8, E = 5, N = 0, O = 1, W = 2. 5480 + 4318 = 9798 1014 + 2075 = 3089 7449 + 8064 = 15513 48229 + 5373 = 53601 47119 + 5261 = 52380 36887 + 4028 = 40915 83442 + 9204 = 92651 74465 + 8236 = 82701 Example 2: Input: crypt = ["RED", "BLUE", "BLACK"] Output: 720 Explanation: Because ther