What is wrong with my code?
@mayank10
make these changes your code will work
- line 12 you should check only for lesser value not for equal value. So change line 12 to if(a[i]<a[j])
- increment i after count+=(e-j+1)*a[i]; operation. So delete i++ from line 15 and write after line 16.
- use long long int.
- to pass all testcases you have to print final ans %1000000007.