Skip to content

Commit 6f8be36

Browse files
authored
Update convert-integer-to-the-sum-of-two-no-zero-integers.cpp
1 parent e8a8e27 commit 6f8be36

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

C++/convert-integer-to-the-sum-of-two-no-zero-integers.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ class Solution {
55
public:
66
vector<int> getNoZeroIntegers(int n) {
77
int a = 0;
8-
for (int curr = n, base = 1; curr; curr /= 10, base *= 10) {
8+
for (int curr = n, base = 1; curr; base *= 10, curr /= 10) {
99
if (curr % 10 == 0 || (curr % 10 == 1 && curr != 1)) {
10-
a += 1 * base;
10+
a += base;
1111
curr -= 10; // carry
1212
}
13-
a += 1 * base;
13+
a += base;
1414
}
1515
return {a, n - a};
1616
}

0 commit comments

Comments
 (0)