Sparse Arrays

  • + 0 comments

    Code in Go, Please suggest if any optimization can be done.

    func matchingStrings(strings []string, queries []string) []int32 { // Write your code here var count int32=0 var stringCount[] int32 for _,query:=range queries{ for _,match:=range strings{ if(query == match){ count = count + 1 } } stringCount = append(stringCount,count) count = 0 }

    return stringCount }