Beginners Approach
\n\n# Approach\n Describe your approach to solving the problem. \n    put all the word from s1 and s2 into frequncy map\n\n    add those word to list , which ha
\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n    put all the word from s1 and s2 into frequncy map\n\n    add those word to list , which have value==1 and is not present in other map \n\n    finally copy the list to String array and return it \n\n# Complexity\n- Time complexity:O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public String[] uncommonFromSentences(String s1, String s2) {\n        String[] t1= s1.split(" ");\n        String[] t2= s2.split(" ");\n        \n        List<String> ls= new ArrayList<>();\n\n\n        \n\n        HashMap<String, Integer> map1= new HashMap<>();\n        HashMap<String, Integer> map2= new HashMap<>();\n\n        for(String s: t1) map1.put(s, map1.getOrDefault(s,0)+1);\n\n        for(String t: t2) map2.put(t, map2.getOrDefault(t,0)+1);\n\n        for(String key: map1.keySet() ){\n            if(map1.get(key)==1 && !map2.containsKey(key)) ls.add(key);\n\n        }\n\n        for(String key: map2.keySet()){\n            if(map2.get(key)==1 && !map1.containsKey(key)) ls.add(key);\n        }\n\n        String[] s= new String[ls.size()];\n\n        for(int i=0;i<s.length;i++){\n            s[i]=ls.get(i);\n\n        }\nreturn s;\n    }\n}\n```
['Java']