diff --git a/solution/0760.Find Anagram Mappings/README.md b/solution/0760.Find Anagram Mappings/README.md new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/solution/0760.Find Anagram Mappings/Solution.java b/solution/0760.Find Anagram Mappings/Solution.java new file mode 100644 index 0000000000000..01baef3ce5e82 --- /dev/null +++ b/solution/0760.Find Anagram Mappings/Solution.java @@ -0,0 +1,17 @@ +import java.util.*; + +class Solution { + public int[] anagramMappings(int[] A, int[] B) { + HashMap map = new HashMap(); + for (int i = 0; i < B.length; i++) { + map.put(B[i], i); + } + int[] res = new int[B.length]; + int j = 0; + for (int k : A) { + res[j++] = map.get(k); + } + + return res; + } +} \ No newline at end of file diff --git a/solution/0771.Jewels and Stones/Solution.java b/solution/0771.Jewels and Stones/Solution.java new file mode 100644 index 0000000000000..6af861f2e7813 --- /dev/null +++ b/solution/0771.Jewels and Stones/Solution.java @@ -0,0 +1,18 @@ +class Solution { + public int numJewelsInStones(String J, String S) { + int res = 0; + for (char c : S.toCharArray()) { + if (contains(J, c)) + res++; + } + return res; + } + + public boolean contains(String s, char c) { + for (char k : s.toCharArray()) { + if (k == c) + return true; + } + return false; + } +} \ No newline at end of file