public void TestSort() { var s = new Solution15(); var rnd = new Random(); var a = Enumerable.Range(0, 10).Select(i => rnd.Next(0, 10)).ToArray(); var e = a.OrderBy(i => i).ToArray(); s.Sort(a, 0, a.Length - 1); Assert.AreEqual(e, a); }
public void Test1() { var s = new Solution15(); var res = s.ThreeSum(new[] { -1, 0, 1, 2, -1, -4 }); Assert.AreEqual(new[] { new[] { -1, 0, 1 }, new[] { -1, -1, 2 }, }, res); }