Make short string out from long string.


  • 0
    M

    For 2 given input strings, you'll return the number of times you can make the short string from the characters in the long string.

    eg. short string: abcd,
    long string: dcdaaccccbbbadewrwrwewewert.
    Return: 2.


  • 0
    M
    public class solution{
        public static int timesOfAppearance(String sString, String lString){
            HashMap<Character, Integer> lHelper = new HashMap<Character, Integer>();
            HashMap<Character, Integer> sHelper = new HashMap<Character, Integer>();
            lHelper = GetCharValue(lString);
            sHelper = GetCharValue(sString);
    //Then go further from here to get the times of appearance:
    //......
    //......
    //......
        }
    }

  • 0

    Why is the answer not 3?


  • 0
    M

    Yes, it should return 3. My apology. I omitted the last 'a'.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.