mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-10 13:39:08 +08:00
Add tests SumOfSubset
(#5021)
* Updated main and test * removed * style: reorder test cases --------- Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
This commit is contained in:
@ -1,17 +1,6 @@
|
||||
package com.thealgorithms.dynamicprogramming;
|
||||
|
||||
public class Sum_Of_Subset {
|
||||
|
||||
public static void main(String[] args) {
|
||||
int[] arr = {7, 3, 2, 5, 8};
|
||||
int Key = 14;
|
||||
|
||||
if (subsetSum(arr, arr.length - 1, Key)) {
|
||||
System.out.print("Yes, that sum exists");
|
||||
} else {
|
||||
System.out.print("Nope, that number does not exist");
|
||||
}
|
||||
}
|
||||
public class SumOfSubset {
|
||||
|
||||
public static boolean subsetSum(int[] arr, int num, int Key) {
|
||||
if (Key == 0) {
|
Reference in New Issue
Block a user