Can be easily solve using map

Just need to count no. of character in A+ no. of character in B == no. of character in C
             map<char,int>dp1;
                map<char,int>dp2;
                for(int i=0;i<nA;i++){
                    dp1[A[i]]++;
                }
                for(int i=0;i<nB;i++){
                    dp1[B[i]]++;
                }
            
            for(int i=0;i<nC;i++){
                dp2[C[i]]++;
            }
            if(dp1==dp2){
                return 1;
            }
            return 0;

@nandkishor8878

I think it fails, if the input is “abc”, “aba”, “aaabbc”.

Click here to start solving coding interview questions