countPossibleWords static method
Implementation
static BigInt countPossibleWords(int length, String chars) {
int charsetSize = chars.length;
int maxLength = length;
BigInt base = BigInt.from(charsetSize);
BigInt numerator = base.pow(maxLength + 1) - base;
BigInt denominator = BigInt.from(charsetSize - 1);
BigInt total = numerator ~/ denominator;
return total;
}