We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This is supposed to be my GO solution. BUT I CANT COMPILE IT. I think there's a problem with the other part of the code in GO.
funcmatchingStrings(strings[]string,queries[]string)[]int32{// Write your code hereresults:=[]int32{}varmappedStringsmap[string]intmappedStrings=make(map[string]int)for_,stringVar:=range(strings){value,exists:=mappedStrings[stringVar]ifexists{mappedStrings[stringVar]=value+1}else{mappedStrings[stringVar]=1}}for_,query:=range(queries){value,exists:=mappedStrings[query]ifexists{results=append(results,int32(value))}else{results=append(results,int32(0))}}returnresults}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sparse Arrays
You are viewing a single comment's thread. Return to all comments →
This is supposed to be my GO solution. BUT I CANT COMPILE IT. I think there's a problem with the other part of the code in GO.