Skip to content

Commit a88ea5f

Browse files
authored
feat: add solutions to lc problem: No.3032
1 parent 00e5ee0 commit a88ea5f

File tree

1 file changed

+9
-8
lines changed
  • solution/3000-3099/3032.Count Numbers With Unique Digits II

1 file changed

+9
-8
lines changed

solution/3000-3099/3032.Count Numbers With Unique Digits II/README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -300,19 +300,20 @@ public:
300300
bool isvalid(int n) {
301301
vector<bool> present(10, false);
302302
while (n) {
303-
const int dig = n % 10;
304-
if (present[dig])
305-
return false;
306-
present[dig] = true;
307-
n /= 10;
303+
const int dig = n % 10;
304+
if (present[dig])
305+
return false;
306+
present[dig] = true;
307+
n /= 10;
308308
}
309309
return true;
310310
}
311311
int numberCount(int a, int b) {
312312
int res = 0;
313-
for (int i = a; i <= b; ++i)
314-
if (isvalid(i)){
315-
++res;
313+
for (int i = a; i <= b; ++i) {
314+
if (isvalid(i)) {
315+
++res;
316+
}
316317
}
317318
return res;
318319
}

0 commit comments

Comments
 (0)