Accepted solution

Designer PDF Viewer(Hacker Rank)

Open original problem
Source code

// Complete the designerPdfViewer function below.

int designerPdfViewer(vector<int> h, string word)

{

   int max=0;

    for(int i=0;i<word.size();i++)

    {

        int a=h[int(word[i])-97];

        if(a>max)

        {

            max = a;

        }

    }

    return max*word.size();

}
Join the discussion

Add your comment