public void Test1() { // Arrange var a = new NumArray(new[] { -2, 0, 3, -5, 2, -1 }); // Act // Assert Assert.AreEqual(1, a.SumRange(0, 2)); Assert.AreEqual(-1, a.SumRange(2, 5)); Assert.AreEqual(-3, a.SumRange(0, 5)); }
public static void Main(string[] args) { var arr = new NumArray(new int[] { 1, 3, 5 }); var sum = arr.SumRange(0, 2); }