I have coded my solution and it is submitted successfully but the speed is very slow faster than 5% only.
Can u help me to Optimize it where I can optimize it .
Problem>>> https://leetcode.com/problems/sum-of-subarray-minimums/
My code>>>
https://ide.codingblocks.com/s/478121
Sum of Subarray Minimums Leetcode
hello @joshisanjay8467
yours solution is also O(N). and logic is also same as others are doing.
becuase of implementation it might be slow.
trying doing it in single pass (similar to histogram problem)