public void CanPartitionTests()
        {
            PartitionEqualSubsetSum obj = new PartitionEqualSubsetSum();

            //Input: [1, 5, 11, 5]
            //Output: true
            //Explanation: The array can be partitioned as [1, 5, 5] and[11].
            int[] array = new int[] { 1, 5, 11, 5 };
            var   x     = obj.CanPartition(array);

            //Input: [1, 2, 3, 5]
            //Output: false
            //Explanation: The array cannot be partitioned into equal sum subsets.
            array = new int[] { 1, 2, 4, 8 };
            x     = obj.CanPartition(array);
        }
예제 #2
0
 public void Given_array_When_find_Then_return()
 {
     Assert.AreEqual(true, PartitionEqualSubsetSum.CanPartition(new int[] { 1, 11, 5, 5 }));
 }