the width sequence difference maximum minimum element sequencegiven array integer num return sum width nonempty subsequence num since answer large return modulo 109 7a subsequence sequence derive array delete element change order remain element for example 3627 subsequence array 0316227 Example 1input num 213output 6explanation the subsequence 1 2 3 21 23 13 213the correspond width 0 0 0 1 1 2 2the sum width 6example 2input num 2output 0 Constraints1 numslength 1051 numsi 105