Code:- class Solution { public String[] uncommonFromSentences(String s1, String s2) { String[] str1 = s1.split(" "); String[] str2 = s2.split(" "); HashMap hm = new HashMap(); for(String s : str1){ hm.put(s,hm.getOrDefault(s,0)+1); } for(String s : str2){ hm.put(s,hm.getOrDefault(s,0)+1); } int count=0; for(Map.Entry e : hm.entrySet()){ if(e.getValue() == 1){ count++; } } String[] arr = new String[count]; int k=0; for(Map.Entry e : hm.entrySet()){ if(e.getValue() == 1){ arr[k]=e.getKey(); k++; } } return arr; } }
@YATINDRATiwari-m3nАй бұрын
before watching this video i dont know how to use hashmap but the way u explain it , i know this question as well i know how to use hashmap too. thank you 💌, and yes ur voice is so sweet 🤌
@quicklearninigwithsreeАй бұрын
My pleasure 😁
@hackerIfeelYou9 ай бұрын
your voice is so sweet yrr and nice explanation
@SitaRam-js9fuАй бұрын
Nice complexity analysis...i have a suggestion...Ma'am u can use pen to visualize hasmap stored data in example
@quicklearninigwithsreeАй бұрын
Noted.
@madhusudhanssudhan8046Ай бұрын
10/10 teaching😍
@harsha9808Ай бұрын
nice explanation mam ,but the volume of voice should be a little bit high with clarity.
@quicklearninigwithsreeАй бұрын
@@harsha9808 thank you for your feedback will work on that 😄