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
I'm pretty sure that the answer is to simply put the *s right before the biggest digits, so that the largest digit have the biggest impact. For example, if we have
1826456903521651
and we have five multiplications, this would be the answer.
1*82*645*6*903521*651
So the running time would be linear.
Edit: Okay, so this is wrong. We have two counterexamples.