PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Bank of America

Compute maximum beauty of a string

Last updated: Mar 29, 2026

Quick Overview

This question evaluates skills in string manipulation, frequency analysis, and optimization of weighted sums, focusing on assigning distinct values to characters to maximize an aggregate metric.

  • Medium
  • Bank of America
  • Coding & Algorithms
  • Data Scientist

Compute maximum beauty of a string

Company: Bank of America

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Take-home Project

Given a string s, define the beauty of each letter a–z as a distinct integer between 1 and 26, case-insensitive. The beauty of a string is the sum over letters of (letter beauty × its frequency). Ignore punctuation and spaces. For each input line containing a string, compute and print the maximum possible beauty by choosing an assignment of beauties to letters that maximizes the sum. Examples: Input "ABbCCC" → 152; Input "Ignore punctuation, please :)" → 491.

Quick Answer: This question evaluates skills in string manipulation, frequency analysis, and optimization of weighted sums, focusing on assigning distinct values to characters to maximize an aggregate metric.

Related Interview Questions

  • Convert number words to integer - Bank of America (Medium)
  • Explain coding solution and alternatives - Bank of America (Medium)
Bank of America logo
Bank of America
Aug 11, 2025, 12:00 AM
Data Scientist
Take-home Project
Coding & Algorithms
1
0

Given a string s, define the beauty of each letter a–z as a distinct integer between 1 and 26, case-insensitive. The beauty of a string is the sum over letters of (letter beauty × its frequency). Ignore punctuation and spaces. For each input line containing a string, compute and print the maximum possible beauty by choosing an assignment of beauties to letters that maximizes the sum. Examples: Input "ABbCCC" → 152; Input "Ignore punctuation, please :)" → 491.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Bank of America•More Data Scientist•Bank of America Data Scientist•Bank of America Coding & Algorithms•Data Scientist Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.