Skip to content

Commit b1a7814

Browse files
authored
Update confusing-number-ii.cpp
1 parent 823a9c1 commit b1a7814

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

C++/confusing-number-ii.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ class Solution {
2929
return total - 1; // exclude 0
3030
}
3131

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]
3333
const auto& s = to_string(n);
3434
int valid = 0;
3535
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
3737
if (i == 1) {
3838
valid += accumulate(cbegin(centers), cend(centers), 0,
3939
[](const auto& total, const auto& kvp) {
@@ -45,14 +45,14 @@ class Solution {
4545
}
4646
}
4747
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
4949
valid += total * (lookup.size() - 1);
5050
total *= lookup.size();
5151
}
5252
return valid;
5353
}
5454

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]
5656
const auto& s = to_string(n);
5757
const auto& half_s = s.substr(0, (s.length() + 1) / 2);
5858
int total = 0;

0 commit comments

Comments
 (0)