• + 0 comments

    Java Solution:

    public static int designerPdfViewer(List<Integer> h, String word) {
        int maxHeight = 0;
    
        for (int i = 0; i < word.length(); i++) {
            int index = ((int) word.charAt(i)) - 97;
            if (maxHeight < h.get(index)) {
                maxHeight = h.get(index);
            }
        }
    
        return maxHeight * word.length();
    }