no message
This commit is contained in:
@@ -87,15 +87,25 @@ class Verbraucher_extern extends IPSModule
|
||||
return array_values(array_unique($kombinationen));
|
||||
}
|
||||
|
||||
private function findCombinationRecursive($power, $values, $currentCombination, $startIndex, &$result) {
|
||||
if ($power == 0) {
|
||||
$result = $currentCombination;
|
||||
return true;
|
||||
}
|
||||
if ($power < 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private
|
||||
function findCombinationRecursive($power, $values, $currentCombination, $startIndex, &$result) {
|
||||
if ($power == 0) {
|
||||
$result = $currentCombination;
|
||||
return true;
|
||||
}
|
||||
if ($power < 0) {
|
||||
return false;
|
||||
}
|
||||
for ($i = $startIndex; $i < count($values); $i++) {
|
||||
$currentCombination[] = $values[$i];
|
||||
if (findCombinationRecursive($power - $values[$i], $values, $currentCombination, $i + 1, $result)) {
|
||||
return true;
|
||||
}
|
||||
array_pop($currentCombination);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private function findCombination($power, $values) {
|
||||
$result = [];
|
||||
|
||||
Reference in New Issue
Block a user