improved problem solving

Run Settings
LanguageJava
Language Version
Run Command
import java.util.*; class Main { public static void main(String[] args) { char[] array1 = {'a','b','c','x'}; char[] array2 = {'z','y','x'}; boolean answer = containsValue(array1, array2); System.out.println(answer); } public static boolean containsValue(char[] arr1, char[] arr2) { if (arr1.length > arr2.length) { HashMap<Character,Integer> map = new HashMap<>(); for (char c : arr1) map.put(c, 1); for (char c : arr2) if (map.containsKey(c)) return true; } return false; } }
Editor Settings
Theme
Key bindings
Full width
Lines