mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-24 04:54:21 +08:00
style: enable ParameterName
in CheckStyle. (#5196)
* Enabled: ParameterName in CheckStyle. * Refactored to fix bug caused by selfAssignment of variables in VectorCrossproduct class
This commit is contained in:

committed by
GitHub

parent
2568b96784
commit
c42b1c940c
@ -4,16 +4,16 @@ public final class SumOfSubset {
|
||||
private SumOfSubset() {
|
||||
}
|
||||
|
||||
public static boolean subsetSum(int[] arr, int num, int Key) {
|
||||
if (Key == 0) {
|
||||
public static boolean subsetSum(int[] arr, int num, int key) {
|
||||
if (key == 0) {
|
||||
return true;
|
||||
}
|
||||
if (num < 0 || Key < 0) {
|
||||
if (num < 0 || key < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean include = subsetSum(arr, num - 1, Key - arr[num]);
|
||||
boolean exclude = subsetSum(arr, num - 1, Key);
|
||||
boolean include = subsetSum(arr, num - 1, key - arr[num]);
|
||||
boolean exclude = subsetSum(arr, num - 1, key);
|
||||
|
||||
return include || exclude;
|
||||
}
|
||||
|
Reference in New Issue
Block a user