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.
funcdesignerPdfViewer(h[]int32,wordstring)(selectionint32){// Create map of letter heightsm:=make(map[rune]int32)letters:="abcdefghijklmnopqrstuvwxyz"foridx,letter:=rangeletters{m[letter]=h[idx]}// Find maximum heightmax:=int32(0)for_,letter:=rangeword{ifm[letter]>max{max=m[letter]}}// Calculate highlight/selection sizeselection=int32(len(word))*maxreturn}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Designer PDF Viewer
You are viewing a single comment's thread. Return to all comments →
Go Golang Solution O(n)