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