Exemple #1
0
 static void Main(string[] args)
 {
     var list = new List <long>()
     {
         1, 5, 5, 25, 125
     };
     long r      = 5;
     long result = TripletsHelper.countTriplets(list, r);
 }
Exemple #2
0
    public void MassiveTest()
    {
        var list = new List <long>();

        for (int i = 0; i < 100000; i++)
        {
            list.Add(1237);
        }

        long r      = 1;
        long result = TripletsHelper.countTriplets(list, r);

        Assert.Equal(166661666700000, result);
    }
Exemple #3
0
    public void VerifyTripletsCounting()
    {
        var list = new List <long>()
        {
            1, 5, 5, 25, 125
        };
        long r      = 5;
        long result = TripletsHelper.countTriplets(list, r);

        Assert.Equal(4, result);
        r    = 3;
        list = new List <long>()
        {
            1, 3, 9, 9, 27, 81
        };
        result = TripletsHelper.countTriplets(list, r);
        Assert.Equal(6, result);
    }