diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2020-10-05 05:09:37 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2020-10-05 05:09:37 +0100 |
| commit | cef248ba491398a30061ba49fbc2a824116ae996 (patch) | |
| tree | 6ecffe1f1d752b33fb17ffc3071eff00b2b3029a /challenge-081/james-smith | |
| parent | 2f3b402ce4ccee68dd46ba26529aea5408422a39 (diff) | |
| download | perlweeklychallenge-club-cef248ba491398a30061ba49fbc2a824116ae996.tar.gz perlweeklychallenge-club-cef248ba491398a30061ba49fbc2a824116ae996.tar.bz2 perlweeklychallenge-club-cef248ba491398a30061ba49fbc2a824116ae996.zip | |
- Added template for Challenge 81.
Diffstat (limited to 'challenge-081/james-smith')
| -rw-r--r-- | challenge-081/james-smith/README.md | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-081/james-smith/README.md b/challenge-081/james-smith/README.md new file mode 100644 index 0000000000..b1f39c934a --- /dev/null +++ b/challenge-081/james-smith/README.md @@ -0,0 +1,18 @@ +Solutions by James Smith. + +# Challenge 1 - Smallest Positive Number + +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} + |
