• + 0 comments

    Java Solution

    class Result {
    
        /*
         * Complete the 'designerPdfViewer' function below.
         *
         * The function is expected to return an INTEGER.
         * The function accepts following parameters:
         *  1. INTEGER_ARRAY h
         *  2. STRING word
         */
    
        public static int designerPdfViewer(List<Integer> h, String word) {
        // Write your code here
            String alpha = "abcdefghijklmnopqrstuvwxyz";
            int max = 0;
             int len = word.length();
             
            for(int i = 0; i < len; i++)
            {
                char curr = word.charAt(i); //t
                for(int j = 0; j< alpha.length(); j++)
                {
                    char cu = alpha.charAt(j);
                    if(curr == cu)
                    {
                        if(h.get(j) > max)
                        {
                            max = h.get(j);
                        }
                    }
                }
            }
           
            return len * max;
            
            
            
            
        }
    
    }