aboutsummaryrefslogtreecommitdiff
path: root/challenge-240
diff options
context:
space:
mode:
authoririfkin <ianrifkin@ianrifkin.com>2023-10-28 17:57:56 -0400
committeririfkin <ianrifkin@ianrifkin.com>2023-10-28 17:57:56 -0400
commit78f1b20764ce5961ac74f9fcb1bed919d6a691a6 (patch)
tree104bf5ca8727b26f5d4d75b072f42a18dd6b481e /challenge-240
parentc6e15af7dacac227742bc2253a5223648b2457de (diff)
downloadperlweeklychallenge-club-78f1b20764ce5961ac74f9fcb1bed919d6a691a6.tar.gz
perlweeklychallenge-club-78f1b20764ce5961ac74f9fcb1bed919d6a691a6.tar.bz2
perlweeklychallenge-club-78f1b20764ce5961ac74f9fcb1bed919d6a691a6.zip
more README formatting
Diffstat (limited to 'challenge-240')
-rw-r--r--challenge-240/ianrifkin/README.md2
1 files changed, 1 insertions, 1 deletions
diff --git a/challenge-240/ianrifkin/README.md b/challenge-240/ianrifkin/README.md
index a56cf8eeb5..a3d7bf545f 100644
--- a/challenge-240/ianrifkin/README.md
+++ b/challenge-240/ianrifkin/README.md
@@ -65,7 +65,7 @@ Input: @int = (5, 0, 1, 2, 3, 4)
Output: (4, 5, 0, 1, 2, 3)
```
-Doing new[i] = old[old[i]] seemed simple enough but I do have trouble mentally processing where 0 <= i < new.length. If `i` is a postion of the input array it is always going to be equal to or greater than 0 because of how arrays are numbered. Since each new[i] is mapped to a value calculated from the old array they should naturally end up the same length, so `i` should never be longer than new.length because `i` shouldn't be less than old.length either.
+Doing `new[i] = old[old[i]]` seemed simple enough but I do have trouble mentally processing `where 0 <= i < new.length`. If `i` is a postion of the input array it is always going to be equal to or greater than 0 because of how arrays are numbered. Since each new[i] is mapped to a value calculated from the old array they should naturally end up the same length, so `i` should never be longer than new.length because `i` shouldn't be less than old.length either.
With that out of the way, I did a simple for loop using the iterator variable `$i` -- within the loop I am literally just doing the exact mapping from the question: `new[i] = old[old[i]]`