diff options
| author | drbaggy <js5@sanger.ac.uk> | 2020-09-28 22:21:44 +0100 |
|---|---|---|
| committer | drbaggy <js5@sanger.ac.uk> | 2020-09-28 22:21:44 +0100 |
| commit | 6f3d1eab2a1d4b557312bf20c60ae818afe69f34 (patch) | |
| tree | 9fcda0532283fb976fb73d2d06b92a442c53c6b1 /challenge-080 | |
| parent | 0093bbf3c47acc6b7ed4a3bc749767a6858a4d5c (diff) | |
| download | perlweeklychallenge-club-6f3d1eab2a1d4b557312bf20c60ae818afe69f34.tar.gz perlweeklychallenge-club-6f3d1eab2a1d4b557312bf20c60ae818afe69f34.tar.bz2 perlweeklychallenge-club-6f3d1eab2a1d4b557312bf20c60ae818afe69f34.zip | |
x
Diffstat (limited to 'challenge-080')
| -rw-r--r-- | challenge-080/james-smith/README.md | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/challenge-080/james-smith/README.md b/challenge-080/james-smith/README.md index a3404cb84a..b1f39c934a 100644 --- a/challenge-080/james-smith/README.md +++ b/challenge-080/james-smith/README.md @@ -2,9 +2,17 @@ Solutions by James Smith. # Challenge 1 - Smallest Positive Number -After testing two solutions (using sort and using hash keys) it became obvious the best way of handling this is to sort the +ve numbers and them loop through them to find the first missing one (the first number which has the value in the array not equal to the 1-based index) +After testing three solutions: + + * using sort + * using hash keys + * scanning with the numbers 1, 2, 3 etc + +it became obvious the best way of handling this is to sort the +ve numbers and them loop through them to find the first missing one (the first number which has the value in the array not equal to the 1-based index) was the quicksest... # Challenge 2 - Count candies This is a simple sweep approach applying the b) rule multiple times until the counting stops! +Note you have to do this repeatedly till you find the right answer - a single pass will not return the right value {especially in more complex environments} + |
