diff options
| author | James Smith <js5@sanger.ac.uk> | 2022-02-11 01:06:31 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-11 01:06:31 +0000 |
| commit | 7a06a5f729b4f71c1cd60e246ed15d5faaabe9b5 (patch) | |
| tree | 097b703504f6f9a135648ee9e61c2f0ecfba362c | |
| parent | 51f58739137c4fdab173493328641288827acb37 (diff) | |
| download | perlweeklychallenge-club-7a06a5f729b4f71c1cd60e246ed15d5faaabe9b5.tar.gz perlweeklychallenge-club-7a06a5f729b4f71c1cd60e246ed15d5faaabe9b5.tar.bz2 perlweeklychallenge-club-7a06a5f729b4f71c1cd60e246ed15d5faaabe9b5.zip | |
Update README.md
| -rw-r--r-- | challenge-151/james-smith/README.md | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/challenge-151/james-smith/README.md b/challenge-151/james-smith/README.md index 7f3a84e2f4..b6806a1ee6 100644 --- a/challenge-151/james-smith/README.md +++ b/challenge-151/james-smith/README.md @@ -49,6 +49,19 @@ sub depth { We can walk along the house and work out what the best score we could get if we stopped the journey at any house. As we add in each extra house - best score depends on the best score of one of the last two houses visited and the points of the current house. +We will only ever skip one or two houses at each "jump", we will never skip more than two. There is always a better option which is to select one of the nodes in the middle. So the jump from 1 to 5 (skipping three) will always score less than the jump from 1 to 3 and 3 to 5. This is because you will miss plundering house No 3.... + +``` + ====== ====== ====== ====== ====== ====== + ======== ======== ======== ======== ======== ======== + | No 1 | | No 2 | | No 3 | | No 4 | | No 5 | | No 6 | + -------- -------- -------- -------- -------- -------- + | | | | | | + | `--->------>---' `--->------>---' | + | | + `--->------>------>------>------>------>---' +``` + Here we construct and array of the best total we could achieve if we stopped at the 1st, 2nd, 3rd houses etc... For the first two: |
