package leetcode;

/**
 * https://leetcode.com/problems/find-anagram-mappings/
 */
public class Problem760 {
    public int[] anagramMappings(int[] A, int[] B) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem760 prob = new Problem760();
        System.out.println(prob.anagramMappings(new int[]{12, 28, 46, 32, 50}, new int[]{50, 12, 32, 46, 28})); // [1, 4, 3, 2, 0]
    }
}

@@ -12,16 +12,94 @@
 tcode;%0A%0A
+import java.util.HashMap;%0Aimport java.util.LinkedList;%0Aimport java.util.Map;%0A%0A
 /**%0A * h
@@ -245,85 +245,148 @@
     
-// TODO%0A        return null;
+Map%3CInteger, LinkedList%3CInteger%3E%3E map = new HashMap%3C%3E();%0A        for (int i = 0; i %3C B.length; i++) %7B
 %0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args
+    if (!map.containsKey(B%5Bi%5D)
 ) %7B%0A
@@ -397,174 +397,460 @@
     
+ 
-Problem760 prob = new Problem760();%0A        System.out.println(prob.anagramMappings(new int%5B%5D%7B12, 28, 46, 32, 50%7D, new int%5B%5D%7B50, 12, 32, 46, 28%7D)); // %5B1, 4, 3, 2, 0%5D
+       LinkedList%3CInteger%3E list = new LinkedList%3C%3E();%0A                list.add(i);%0A                map.put(B%5Bi%5D, list);%0A            %7D else %7B%0A                map.get(B%5Bi%5D).add(i);%0A            %7D%0A        %7D%0A        int%5B%5D result = new int%5BA.length%5D;%0A        for (int i = 0; i %3C A.length; i++) %7B%0A            LinkedList%3CInteger%3E list = map.get(A%5Bi%5D);%0A            Integer idx = list.removeFirst();%0A            result%5Bi%5D = idx;%0A        %7D%0A        return result;
 %0A   

Solve problem 760