you give integer array num the range subarray num difference large small element subarrayreturn sum subarray range numsA subarray contiguous nonempty sequence element array Example 1input num 123output 4explanation the 6 subarray num following1 range large small 1 1 0 2 range 2 2 03 range 3 3 012 range 2 1 123 range 3 2 1123 range 3 1 2so sum range 0 0 0 1 1 2 4example 2input num 133output 4explanation the 6 subarray num following1 range large small 1 1 03 range 3 3 03 range 3 3 013 range 3 1 233 range 3 3 0133 range 3 1 2so sum range 0 0 0 2 0 2 4example 3input num 42341output 59explanation the sum subarray range num 59 Constraints1 numslength 1000109 numsi 109 Followup could find solution on time complexity