We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 55bb18c commit 715c3fcCopy full SHA for 715c3fc
Recursion/3704.Count-No-Zero-Pairs-That-Sum-to-N/3704.Count-No-Zero-Pairs-That-Sum-to-N.cpp
@@ -21,12 +21,8 @@ class Solution {
21
if(endA==1 && i!=0) continue;
22
if(endA==0 && i==0) continue;
23
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
-
+ if (endA) A = {1};
+ else A = {0,1};
30
31
for (int j=0; j<=9; j++) {
32
if (endB==1 && j!=0) continue;
@@ -36,11 +32,8 @@ class Solution {
36
int ncarry = (sum>=10)?1:0;
37
33
38
34
vector<int>B;
39
- if (endB) B.push_back(1);
40
41
- B.push_back(0);
42
- if (j!=0) B.push_back(1);
43
35
+ if (endB) B = {1};
+ else B = {0,1};
44
45
for (int nxt_enda: A)
46
for (int nxt_endb: B)
0 commit comments