Company: Teradata_._
Difficulty: medium
Crayon Removal Scoring Game Problem Description A box holds a row of N crayons. Each crayon has a colour, written as a lowercase English letter. You play a game that removes all the crayons, one move at a time. In each move you choose one contiguous group of crayons that all have the same colour and take that group out of the box. If the group has x crayons ( x >= 1 ), you earn x * x points. When a group is taken out, the crayons on its left and right close the gap and become neighbours, so crayons of the same colour that were separated may now form one longer group. The game ends when the box is empty. Find the maximum total score you can earn. Complete the function solve(N, colors) , which receives the number of crayons N and the array colors of their colours from left to right, and returns the maximum total score. Input Format Read from standard input. N colors[0] colors[1] ... colors[N-1] Line 1 contains the integer N , the number of crayons in the box. Line 2 contains N space-s