we array integer num array request requestsi starti endi the ith request ask sum numsstarti numsstarti 1 numsendi 1 numsendi both starti endi 0indexedreturn maximum total sum request permutation numssince answer large return modulo 109 7 Example 1input num 12345 request 1301output 19explanation one permutation num 21345 follow result requests0 nums1 nums2 nums3 1 3 4 8requests1 nums0 nums1 2 1 3total sum 8 3 11a permutation high total sum 35421 follow resultrequests0 nums1 nums2 nums3 5 4 2 11requests1 nums0 nums1 3 5 8total sum 11 8 19 good doExample 2input num 123456 request 01output 11explanation a permutation max total sum 654321 request sum 11example 3input num 1234510 request 021311output 47explanation a permutation max total sum 4105321 request sum 191810 Constraintsn numslength1 n 1050 numsi 1051 requestslength 105requestsilength 20 starti endi n