Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add solutions to lc problem: No.3032 #2331

Merged
merged 13 commits into from
Feb 10, 2024
Merged
Prev Previous commit
Next Next commit
feat: add solutions to lc problem: No.3032
  • Loading branch information
Nothing-avil authored Feb 9, 2024
commit a88ea5f3679a6a00cc74af832b919abab12a4737
Original file line number Diff line number Diff line change
Expand Up @@ -300,19 +300,20 @@ public:
bool isvalid(int n) {
vector<bool> present(10, false);
while (n) {
const int dig = n % 10;
if (present[dig])
return false;
present[dig] = true;
n /= 10;
const int dig = n % 10;
if (present[dig])
return false;
present[dig] = true;
n /= 10;
}
return true;
}
int numberCount(int a, int b) {
int res = 0;
for (int i = a; i <= b; ++i)
if (isvalid(i)){
++res;
for (int i = a; i <= b; ++i) {
if (isvalid(i)) {
++res;
}
}
return res;
}
Expand Down
Loading