Input:
Source: “aaa”
Target: “bbb”
Result: 1
since it only requires a->b conversion
Input 2:
Source: “ababcc”
Target: “cccccc”
Result: 2
First, it require to convert a=>b which will become “bbbbcc”
Second, convert b=> c which will match target “cccccc”
Input 3:
Source: “ab”
Target: “ba”
Result: 3
T1: a => c which will become ab=>“cb”
T2: b => a which will become cb=>“ca”
T3: c=> b which will become ca=>“ba”
Java code:
public int minCharacterTransform(String source, String target){
}