Add Partition Problem (#4182)

This commit is contained in:
Md. Asif Joardar
2023-05-09 16:21:11 +06:00
committed by GitHub
parent 3a593d5d3c
commit 3109c11c59
3 changed files with 65 additions and 1 deletions

View File

@ -0,0 +1,24 @@
package com.thealgorithms.dynamicprogramming;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class PartitionProblemTest {
@Test
public void testIfSumOfTheArrayIsOdd(){
assertFalse(PartitionProblem.partition(new int[]{1, 2, 2}));
}
@Test
public void testIfSizeOfTheArrayIsOne(){
assertFalse(PartitionProblem.partition(new int[]{2}));
}
@Test
public void testIfSumOfTheArrayIsEven1(){
assertTrue(PartitionProblem.partition(new int[]{1, 2, 3, 6}));
}
@Test
public void testIfSumOfTheArrayIsEven2(){
assertFalse(PartitionProblem.partition(new int[]{1, 2, 3, 8}));
}
}