Sum of Total Strength of Wizards
As the ruler of a kingdom, you command an army of wizards.
You are provided with a list of integers called strength, where strength[i] represents the strength of the ith wizard. The total strength of a contiguous group of wizards is defined as the product of the weakest wizard's strength within the group and the sum of all individual strengths in the group.
Calculate the sum of the total strengths of all contiguous groups of wizards. Due to potentially large values, print the result modulo 10^9 + 7.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)