Posted on

Description

Submission

class Solution {
public:
    vector<int> anagramMappings(vector<int>& A, vector<int>& B) {
        map<int, int> Map;
        int n = B.size();
        for(int i = 0; i < n; ++i) {
            Map[B[i]] = i;
        }
        vector<int> rets(n);
        for(int i = 0; i < n; ++i) {
            rets[i] = Map[A[i]];
        }

        return rets;
    }
};

Leave a Reply

Your email address will not be published. Required fields are marked *