Solved LeetCode program · 976 of 1,000
#1347 · Minimum Number of Steps to Make Two Strings Anagram
Original English source
Keep a shared subject as empty text. Keep a shared glyphs as empty text. Keep a shared mark of 0. Keep a shared counts as an empty list of whole numbers.
For every slot from 0 to 25.
Place 0 into counts.
Place "abcdefghijklmnopqrstuvwxyz" into glyphs. Place "bab" into subject.
To locate from spot (a whole number). Set mark to -1. The symbol is character spot of subject.
For every slot from 0 to 25.
If character slot of glyphs is symbol, set mark to slot, return.
For every spot from 0 to the last position of subject.
Locate from spot. The local is mark. Increase item local of counts by 1.
Set subject to empty text. Place "aba" into subject.
For every spot from 0 to the last position of subject.
Locate from spot. The local is mark. Decrease item local of counts by 1.
The surplus is 0.
For every slot from 0 to 25.
If item slot of counts is more than 0, set surplus to surplus plus item slot of counts.
Show surplus.
Expected stdout
1