Given an Android3x3key lock screen and two integersmandn, where 1 ≤ m ≤ n ≤ 9, count the total number of unlock patterns of the Android lock screen, which consist of minimum ofmkeys and maximumnkeys.
Rules for a valid pattern:
Each pattern must connect at leastmkeys and at mostnkeys.
All the keys must be distinct.
If the line connecting two consecutive keys in the pattern passes through any other keys, the other keys must have previously selected in the pattern. No jumps through non selected key is allowed.
The order of keys used matters.
1: 1379 这四个数是对称的, 1有多少种可能, 其他三个数也有多少种可能, 所以算的时候 只算一个再乘以4得到他们总和。 2468 同理。
2: 数字不能跳着选, 所以如果是跳着的, 中间间隔的那个数字必须是已经选中过了, 这样引申出来两个数组, boolean[] visited, int[][] skips;
3: 递归回溯每个数字的可能性。
还得再看一遍。不容易想