@@ -29,11 +29,11 @@ class Solution {
29
29
return total - 1 ; // exclude 0
30
30
}
31
31
32
- int validCountInLessLength (int n) { // count unconfused numbers in the pattern of [01689]{1,len(n)-1} in the range of [1, n]
32
+ int validCountInLessLength (int n) { // count unconfusing numbers in the pattern of [01689]{1,len(n)-1} in the range of [1, n]
33
33
const auto & s = to_string (n);
34
34
int valid = 0 ;
35
35
int total = centers.size ();
36
- for (int i = 1 ; i < s.length (); i += 2 ) { // count unconfused numbers for each odd length less than s
36
+ for (int i = 1 ; i < s.length (); i += 2 ) { // count unconfusing numbers for each odd length less than s
37
37
if (i == 1 ) {
38
38
valid += accumulate (cbegin (centers), cend (centers), 0 ,
39
39
[](const auto & total, const auto & kvp) {
@@ -45,14 +45,14 @@ class Solution {
45
45
}
46
46
}
47
47
total = 1 ;
48
- for (int i = 2 ; i < s.length (); i += 2 ) { // count unconfused numbers for each even length less than s
48
+ for (int i = 2 ; i < s.length (); i += 2 ) { // count unconfusing numbers for each even length less than s
49
49
valid += total * (lookup.size () - 1 );
50
50
total *= lookup.size ();
51
51
}
52
52
return valid;
53
53
}
54
54
55
- int validCountInFullLength (int n) { // count unconfused numbers in the pattern of [01689]{len(n)} in the range of [1, n]
55
+ int validCountInFullLength (int n) { // count unconfusing numbers in the pattern of [01689]{len(n)} in the range of [1, n]
56
56
const auto & s = to_string (n);
57
57
const auto & half_s = s.substr (0 , (s.length () + 1 ) / 2 );
58
58
int total = 0 ;
0 commit comments