This was an interview question I had and I was embarrassingly pretty stumped by it. Wanted to know if anyone could think up an answer to it and provide the big O notation for it
This came to mind, it's the brute force approach influenced by the bars and stars problem.
Let's say our number is "12345" and we have 2 * operators we need to use. We can look at the string 12345 as
1_2_3_4_5
Where we can put the two * operators on any of the underscores. Since there are 4 underscores and 2 * operators, there are 4 choose 2 (or 6) different ways to place the operators. Compare those 6 possibilities and grab the largest number. A similar approach can be used for larger strings and larger number of * operators.