Find Anagram Mappings

2018/1/18 posted in  leetcode

class Solution {
public:
    vector<int> anagramMappings(vector<int>& A, vector<int>& B) {
        unordered_map<int, int> map;
        vector<int> res;
        for (int i = 0; i<B.size(); i++) {
            map[B[i]]=i;
        }
        for (int j = 0; j<A.size(); j++) {
            res.push_back(map[A[j]]);
        }
        return res;
    }
};