Skip to content

Commit

Permalink
Time: 50 ms (73.99%), Space: 16.9 MB (82.29%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
Dipendra-Raghav committed Jan 13, 2024
1 parent 51cbda8 commit c410fe3
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class Solution {
public:
int minSteps(string s, string t) {
vector<int> nums(26,0);
int ans=0;
for(int i=0;i<s.size();i++)
{
nums[s[i]-'a']++;
}
for(int i=0;i<t.size();i++)
{
int k=t[i]-'a';
if(nums[k]!=0)nums[k]--;
}
for(int i=0;i<26;i++)
{
ans+=nums[i];
}
return ans;

}
};

0 comments on commit c410fe3

Please sign in to comment.