Tutorial by Examples

Ex1:- let str1 = 'stackoverflow'; let str2 = 'flowerovstack'; These strings are anagrams. // Create Hash from str1 and increase one count. hashMap = { s : 1, t : 1, a : 1, c : 1, k : 1, o : 2, v : 1, e : 1, r : 1, f : 1, l : 1, w : 1...
(function(){ var hashMap = {}; function isAnagram (str1, str2) { if(str1.length !== str2.length){ return false; } // Create hash map of str1 character and increase value one (+1). createStr1HashMap(str1); /...

Page 1 of 1