Company: Trilogy_27july
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 (0-9), and the leading digit of any multi-digit number is not zero. The crypt array has the following structure: [word1, word2, word3] , which stands for the word1 + word2 == word3 cryptarithm. You need to implement the following function: int solution(String[] crypt) Examples Example 1: Input: crypt = ["SEND", "MORE", "MONEY"] Output: 1 Explanation: There is only one solution to this cryptarithm: S=9, E=5, N=6, D=7, M=1, O=0, R=8, Y=2 . This maps to 9567 + 1085 = 10652 . Example 2: Input: crypt = ["GREEN", "BLUE", "BLACK"] Output: 12 Explanation: There are 12 possible valid solutions. For example, one solution maps t