Skip to content

Commit 361d82a

Browse files
author
Ihssaneabousshal
committed
Runtime: 560 ms (Top 5.43%) | Memory: 14.7 MB (Top 97.67%)
1 parent 122ec0f commit 361d82a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/algorithms/C/Change Minimum Characters to Satisfy One of Three Conditions/Change Minimum Characters to Satisfy One of Three Conditions.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Runtime: 560 ms (Top 5.43%) | Memory: 14.7 MB (Top 97.67%)
12
class Solution {
23
public:
34
int count(string &a,string &b)
@@ -15,14 +16,14 @@ class Solution {
1516
int minCharacters(string a, string b) {
1617
int x=count(a,b),y=count(b,a);
1718
int fans=INT_MAX;
18-
19+
1920
for(char c='a';c<='z';c++)
2021
{
2122
int cnt=0;
2223
for(char it:a) cnt+=(it!=c);
2324
for(char it:b) cnt+=(it!=c);
24-
fans=min(fans,cnt);
25+
fans=min(fans,cnt);
2526
}
2627
return min({x,y,fans});
2728
}
28-
};
29+
};

0 commit comments

Comments
 (0)