PHP code example of lmn / subsetsum
1. Go to this page and download the library: Download lmn/subsetsum library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lmn / subsetsum example snippets
$subsetTable = SubsetSum::builder()
->withSet([1, 2, 5])
->withTarget(8)
->build();
$subset = $subsetTable->getSubset(8);
$subsetTable = SubsetSum::builder()
->withSet([1, 2, 5])
...
$subsetTable = SubsetSum::builder()
->withTarget(800)
...
$subsetTable = SubsetSum::builder()
->withTargetSpaced(800, 100)
...
$subsetTable = SubsetSum::builder()
->withTargetSet([1, 2, 3, 5, 8, 13, 21, 34])
...
$subsetTable = SubsetSum::builder()
...
->build();
$subsetTable = SubsetSum::builder()
...
->buildWithRepetition();
$subsetTable = SubsetSum::builder()
...
->onlyExactSum();
$subsetTable = SubsetSum::builder()->...->build();
$subset = $subsetTable->getSubset()
$subsetTable = SubsetSum::builder()->...->build();
$subset = $subsetTable->getSubsetForTarget(100)
$subsetTable = SubsetSum::builder()
->withComperable(new CustomComperable())
...
$subsetTable = SubsetSum::builder()
->preferGreaterSum()
...
$subsetTable = SubsetSum::builder()
->preferLowerSum()
...