isPandigital function
Checks if a number is pandigital.
A pandigital number is an integer that in a given base has among its significant digits each digit used in the base at least once.
Example:
print(isPandigital(1234567890)); // Output: true
print(isPandigital(123456789)); // Output: false
Implementation
bool isPandigital(int n) {
List<int> digits = getDigits(n);
digits.sort();
for (int i = 0; i < digits.length; i++) {
if (digits[i] != i + 1) {
return false;
}
}
return true;
}