Skip to content

Commit 715c3fc

Browse files
authored
Update 3704.Count-No-Zero-Pairs-That-Sum-to-N.cpp
1 parent 55bb18c commit 715c3fc

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

Recursion/3704.Count-No-Zero-Pairs-That-Sum-to-N/3704.Count-No-Zero-Pairs-That-Sum-to-N.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,8 @@ class Solution {
2121
if(endA==1 && i!=0) continue;
2222
if(endA==0 && i==0) continue;
2323
vector<int>A;
24-
if (endA) A.push_back(1);
25-
else {
26-
A.push_back(0);
27-
if (i!=0) A.push_back(1);
28-
}
29-
24+
if (endA) A = {1};
25+
else A = {0,1};
3026

3127
for (int j=0; j<=9; j++) {
3228
if (endB==1 && j!=0) continue;
@@ -36,11 +32,8 @@ class Solution {
3632
int ncarry = (sum>=10)?1:0;
3733

3834
vector<int>B;
39-
if (endB) B.push_back(1);
40-
else {
41-
B.push_back(0);
42-
if (j!=0) B.push_back(1);
43-
}
35+
if (endB) B = {1};
36+
else B = {0,1};
4437

4538
for (int nxt_enda: A)
4639
for (int nxt_endb: B)

0 commit comments

Comments
 (0)