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.
Designer PDF Viewer
Designer PDF Viewer
+ 0 comments javascript solution
function designerPdfViewer(h, word) {
let arrayWordsAlphabetics = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'k', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']; let arrayNumbers = h; let stringWord = word; let arrayNumbersFiltered = []; let maxNumber = 0; let result = 0; for(let i in arrayNumbers) { for(let j in arrayWordsAlphabetics) { for(let k in stringWord) { if(stringWord[k] === arrayWordsAlphabetics[j] && i === j) { arrayNumbersFiltered.push(arrayNumbers[j]); maxNumber = Math.max(...arrayNumbersFiltered); result = maxNumber * stringWord.length; } } } } return result;
}
+ 0 comments Javascript Solution :
function designerPdfViewer(h, word) { let maxHeight = 0 for(let i=0; i < word.length; i++){ let tempHeight = h[word[i].toUpperCase().charCodeAt(0) - 64 - 1] maxHeight = tempHeight > maxHeight ? tempHeight : maxHeight; } return maxHeight * word.length; }
+ 0 comments from string import ascii_lowercase def designerPdfViewer(h, word): letters = ascii_lowercase height = [] for letter in word: height.append(h[letters.index(letter)]) return max(height)*len(word)
+ 0 comments def designerPdfViewer(h, word): alpha_lcase = tuple(chr(ascii) for ascii in range(97, 123)) alphamap = {letter: height for letter, height in zip(alpha_lcase, h)} return max(tuple(alphamap.get(letter, None) for letter in word)) * len(word)
+ 0 comments string="abcdefghijklmnopqrstuvwxyz" maxheight=0 for item in word: pos=string.index(item) height=h[pos] maxheight=max(height,maxheight) area=maxheight*len(word) return area
Load more conversations
Sort 2549 Discussions, By:
Please Login in order to post a comment