give 2D matrix matrix handle multiple query follow typecalculate sum element matrix inside rectangle define upper left corner row1 col1 low right corner row2 col2Implement NumMatrix classNumMatrixint matrix Initializes object integer matrix matrixint sumRegionint row1 int col1 int row2 int col2 return sum element matrix inside rectangle define upper left corner row1 col1 low right corner row2 col2You design algorithm sumregion work o1 time complexity Example 1inputnummatrix sumregion sumregion sumRegion3 0 1 4 2 5 6 3 2 1 1 2 0 1 5 4 1 0 1 7 1 0 3 0 5 2 1 4 3 1 1 2 2 1 2 2 4outputnull 8 11 12explanationnummatrix nummatrix new nummatrix3 0 1 4 2 5 6 3 2 1 1 2 0 1 5 4 1 0 1 7 1 0 3 0 5nummatrixsumregion2 1 4 3 return 8 ie sum red rectanglenumMatrixsumRegion1 1 2 2 return 11 ie sum green rectanglenumMatrixsumRegion1 2 2 4 return 12 ie sum blue rectangle Constraintsm matrixlengthn matrixilength1 m n 200104 matrixij 1040 row1 row2 m0 col1 col2 nAt 104 call sumregion