diff options
author | Haidong Ji | 2018-12-27 09:48:28 -0600 |
---|---|---|
committer | Haidong Ji | 2018-12-27 09:48:28 -0600 |
commit | 993716627a616e821aefd8707230221d0dac6cd7 (patch) | |
tree | 1d4337172a7bc9c4aa43744f9628f2d220e4554c /AlgoDesignAndTechniqueEdxJava/tests/Partition3Test.java | |
parent | e09a3494e3f3b957b10402d9252a0bddec4cc908 (diff) |
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.
Diffstat (limited to 'AlgoDesignAndTechniqueEdxJava/tests/Partition3Test.java')
-rw-r--r-- | AlgoDesignAndTechniqueEdxJava/tests/Partition3Test.java | 25 |
1 files changed, 25 insertions, 0 deletions
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)); + } + +} |