760. Find Anagram Mappings
A = [12, 28, 46, 32, 50]
B = [50, 12, 32, 46, 28][1, 4, 3, 2, 0]解题要点:
class Solution {
public int[] anagramMappings(int[] A, int[] B) {
HashMap<Integer, Integer> map = new HashMap();
for(int i = 0; i < B.length; i++){
map.put(B[i], i);
}
int[] res = new int[A.length];
int j = 0;
for(int a : A){
res[j++] = map.get(a);
}
return res;
}
}Last updated