FastPrepMaximum Crayon Removal Score
Problems/Maximum Crayon Removal Score

Maximum Crayon Removal Score

Wells Fargo logoWells Fargo● HardFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report gives the full removal rule, the scoring goal, a limit, and a worked example. Our version is about 99% the same as the reported question.

You are given a string colors representing crayons arranged in a row. Equal letters represent equal colors.

In one operation, choose a contiguous group of x crayons of the same color, remove it, and earn x * x points. The remaining crayons close the gap and may form new contiguous groups.

Remove every crayon and return the maximum total score.

Function

maximumCrayonScore(colors: String) → int

Examples

Example 1

colors = "abcccbaba"return = 23

Remove ccc for 9, then one b for 1, then the merged bbb for 9, and finally aa for 4.

Example 2

colors = "aba"return = 5

Remove b for 1, then remove the merged aa for 4.

Example 3

colors = "aaa"return = 9

Remove all three crayons in one operation.

Example 4

colors = "ab"return = 2

The two different crayons must be removed separately for one point each.

Constraints

  • 1 <= colors.length <= 60.
  • colors contains lowercase English letters.

More Wells Fargo Online Assessment questions

  • Server Upgrade PlanningOA · Seen Nov 2026
  • Student and Course EnrollmentOA · Seen Nov 2026
  • Bond Interest Summary Above 3%OA · Seen Oct 2026
  • Count Phrases Formed by Anagram ReplacementOA · Seen Oct 2026
  • Event Statistics AggregatorOA · Seen Sep 2026
  • Ordered Deployment Configuration ValidatorOA · Seen Sep 2026
  • Longest Subsequence That Is a SubstringOA · Seen Jul 2026
  • Overloaded Game Account InventoriesOA · Seen Jul 2026
  • Count Server ReplacementsOA · PHONE SCREEN · Seen Feb 2026
  • Minimum Remaining LengthOA · PHONE SCREEN · Seen Feb 2026

Similar questions at other companies

  • Shuffle a String by Swapping Tree ChildrenNutanix · OANutanix interview questions
  • Scramble StringExpedia · ONSITE INTERVIEWExpedia interview questions
  • Edit DistanceAstrotalk · PHONE SCREEN
  • Validate a Palindrome After Limited DeletionsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Minimum Dictionary SegmentsGoogle · PHONE SCREENGoogle interview questions
  • Wildcard Pattern MatchingMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Every Result of Grouping an ExpressionC3.ai · ONSITE INTERVIEWC3.ai interview questions
  • Lexicographically Largest IdentifierAmazon · OA
  • Lexicographically Smallest Grid Path with One Letter ChangeInfosys · OAInfosys interview questions
  • String Formation (Also for AI/ML Software Engineer Intern :)Snowflake · OASnowflake interview questions

Interview reports that mention this question

  • Wells Fargo OA: What It Tests (2026)

Wells Fargo interview experiences

  • Wells Fargo SWE Intern OA and Interview Questions: 18 Experiences
All Wells Fargo interview questionsSee Wells Fargo hiring insights
Saved
class Solution {
    public int maximumCrayonScore(String colors) {
      // write your code here
    }
}
Checking account…