loading...

Designer PDF Viewer Explain - Solution | Javascript

hieusmiths profile image Minh Hieu ・1 min read
function designerPdfViewer(h, word) {
  let max = 0;
  const wordSize = word.length;
  for (let i = 0; i < wordSize; i ++) {
    const current = word.charCodeAt(i);
    if (h[current-97] > max) max = h[current-97];
  }
  return max * wordSize;
}

designerPdfViewer([1, 3, 1, 3, 1, 4, 1, 3, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7]
, 'zaba')

Problem

Discussion

pic
Editor guide
 

Hi there, we encourage authors to share their entire posts here on DEV, rather than mostly pointing to an external link. Doing so helps ensure that readers don’t have to jump around to too many different pages, and it helps focus the conversation right here in the comments section.

If you choose to do so, you also have the option to add a canonical URL directly to your post.