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.
funcmatchingStrings(stringList[]string,queries[]string)[]int32{// Write your code herevarans=make([]int32,len(queries),len(queries))iflen(stringList)==0||len(queries)==0{returnans}varsl=make(map[string]int32,len(stringList))for_,s:=rangestringList{if_,found:=sl[s];found{sl[s]++}else{sl[s]=1}}fori,q:=rangequeries{ifv,found:=sl[q];found{ans[i]=v}}fmt.Println(ans)returnans}
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 →
go