You are viewing a single comment's thread. Return to all comments →
Javascript: Time O(n) Space O(1)
function designerPdfViewer(h, word) { const alphabets = 'abcdefghijklmnopqrstuvwxyz'; let max = 0; for (const l of word) { max = Math.max(max, h[alphabets.indexOf(l)]) } return max * word.length; }
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 →
Javascript: Time O(n) Space O(1)