From 993716627a616e821aefd8707230221d0dac6cd7 Mon Sep 17 00:00:00 2001 From: Haidong Ji Date: Thu, 27 Dec 2018 09:48:28 -0600 Subject: Knapsack partition3 done! I used the "sleep on it" technique and the algo came to me about the time I fall asleep. I started working on this based on algo I thought in my head first thing after my run and shower, and it worked! I then went to edX forum to see what other people are saying. Frankly those forum posts were confusing to me.--- .../tests/Partition3Test.java | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 AlgoDesignAndTechniqueEdxJava/tests/Partition3Test.java (limited to 'AlgoDesignAndTechniqueEdxJava/tests/Partition3Test.java') diff --git a/AlgoDesignAndTechniqueEdxJava/tests/Partition3Test.java b/AlgoDesignAndTechniqueEdxJava/tests/Partition3Test.java new file mode 100644 index 0000000..593d21a --- /dev/null +++ b/AlgoDesignAndTechniqueEdxJava/tests/Partition3Test.java @@ -0,0 +1,25 @@ +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +class Partition3Test { + + @Test + void test() { + int[] a = {3, 3, 3, 3}; + assertEquals(0, Partition3.partition3(a)); + } + + @Test + void test1() { + int[] a = {30}; + assertEquals(0, Partition3.partition3(a)); + } + + @Test + void test2() { + int[] a = {1, 2, 3, 4, 5, 5, 7, 7, 8, 10, 12, 19, 25}; + assertEquals(1, Partition3.partition3(a)); + } + +} -- cgit v1.2.3