give integer array num handle multiple query follow typesupdate value element numscalculate sum element num index leave right inclusive leave rightimplement NumArray classNumArrayint num Initializes object integer array numsvoid updateint index int val Updates value numsindex valint sumrangeint leave int right return sum element num index leave right inclusive ie numsleft numsleft 1 numsright Example 1inputnumarray sumrange update sumrange1 3 5 0 2 1 2 0 2outputnull 9 null 8explanationnumarray numarray new NumArray1 3 5numarraysumrange0 2 return 1 3 5 9numarrayupdate1 2 num 1 2 5numarraysumrange0 2 return 1 2 5 8 constraints1 numslength 3 104100 numsi 1000 index numslength100 val 1000 leave right numslengthat 3 104 call update sumrange