After a recent construction project, you have found that you have some wooden planks of various lengths left over. Knowing that wood is quite valuable, you are going to try to sell them. A local hardware store has offered to buy the planks, but in order to make a retail display they want all the planks they buy to be the same length and they want this length to be some integer value. A local workshop can cut the planks into different lengths for you, but they charge costPerCut for every cut they make. The hardware store will pay woodValue per unit length for the planks that they buy (i.e., if you bring them K planks, each L units long, then they'll pay you K * L * woodValue). Any leftover wood will be thrown away. What is the maximum amount of money that you can make?
You are given a int lengths, in which each element is the length of a single plank of wood. Return an int containing the maximum amount of money that you can make.