It is my algorithm to write in the mock interview. I remembered that I have to work on one multiplication from left to right iteration using dynamic programming, and then two multiplications from right to left calculation.
I have to learn again to write a correct solution in less than 10 minutes. This time I spent 18 minutes, and also I got a hint from the peer. The peer told me to define a variable leftToRight to save product of array elements on line 18, and also switch the order of line 22 and 24 to assign the value first, and then do the multiplication next.
Here is my C# practice.