Files
LeetCode-Go/leetcode/0307.Range-Sum-Query---Mutable/307. Range Sum Query - Mutable_test.go
2020-08-07 17:06:53 +08:00

21 lines
415 B
Go

package leetcode
import (
"fmt"
"testing"
)
func Test_Problem307(t *testing.T) {
obj := Constructor307([]int{1, 3, 5})
fmt.Printf("obj = %v\n", obj)
fmt.Printf("SumRange(0,2) = %v\n", obj.SumRange(0, 2))
obj.Update(1, 2)
fmt.Printf("obj = %v\n", obj)
fmt.Printf("SumRange(0,2) = %v\n", obj.SumRange(0, 2))
}
// SumRange define
func (ma *NumArray) SumRange(i int, j int) int {
return ma.st.Query(i, j)
}