because u can at most have 9 numbers in a password we can simply calculate all the numbers beforehand..... looks like cheating, just for fun

```
public class Solution {
public int numberOfPatterns(int m, int n) {
int[] counts = new int[]{9,56,320,1624,7152,26016,72912,140704,140704};
int sum=0;
for (int i=m-1; i<n; i++) sum+=counts[i];
return sum;
}
}
```