Thanks for your feedback! I wasn't sure how the operator ℅ would work when the result of the division is smaller than one and had no time to test it, so I went for an option I was sure would work. I'll change my solution accordingly.
Time flies while you're having fun, but then one day your bio says something about being a 30+ year veteran in software engineering. Still, I've not seen it all, let alone done it all (yet).
You're right about the (n+6)%6 (its correct, but the +6 does nothing).
However, SavagePixie cleverly rotated the items in the array down one position, to essentially pre-calculate the -1 offset for the first item - so its working correctly.
Very simple but effective answer!
Just two improvements:
(n + 6) % 6
seems a little bit redundant here,n % 6
does the same thing.not at all
, but this returnsI love you
.Thanks for your feedback! I wasn't sure how the operator
℅
would work when the result of the division is smaller than one and had no time to test it, so I went for an option I was sure would work. I'll change my solution accordingly.You're right about the (n+6)%6 (its correct, but the +6 does nothing).
However, SavagePixie cleverly rotated the items in the array down one position, to essentially pre-calculate the -1 offset for the first item - so its working correctly.
Ah, I see. Didn't pay attention there, my bad. Thanks for the explanation. 😀