We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 00e5ee0 commit a88ea5fCopy full SHA for a88ea5f
solution/3000-3099/3032.Count Numbers With Unique Digits II/README.md
@@ -300,19 +300,20 @@ public:
300
bool isvalid(int n) {
301
vector<bool> present(10, false);
302
while (n) {
303
- const int dig = n % 10;
304
- if (present[dig])
305
- return false;
306
- present[dig] = true;
307
- n /= 10;
+ const int dig = n % 10;
+ if (present[dig])
+ return false;
+ present[dig] = true;
+ n /= 10;
308
}
309
return true;
310
311
int numberCount(int a, int b) {
312
int res = 0;
313
- for (int i = a; i <= b; ++i)
314
- if (isvalid(i)){
315
- ++res;
+ for (int i = a; i <= b; ++i) {
+ if (isvalid(i)) {
+ ++res;
316
+ }
317
318
return res;
319
0 commit comments