Company: Teradata_._
Difficulty: medium
Crayon Removal Scoring Game Description You have a container filled with crayons of various colors, where each color is represented by a different alphabet letter. In each move, you can eliminate a sequence of adjacent crayons that share the same color. You may repeat this process multiple times until the container becomes empty. For each move, you must select a continuous group of identical colored crayons (a group of x crayons, where x ≥ 1 ). Upon removing them, you earn x*x points. You are provided with an integer N representing the total count of crayons in the container and an array colors containing the N colors in the container, where each color is denoted by an English alphabet letter. Calculate the maximum points you can achieve in this scenario. Example Input: N = 7 colors = ["a", "a", "b", "b", "a", "a", "c"] Output: 21 Explanation: One optimal sequence of moves is as follows: Initial state: [a, a, b, b, a, a, c] . Total points = 0. Move 1: Remove the two 'b's. The array