6
For the question Find the highest unique digit , here is my answer :
9A,sqfe=W%X#-
At the end I am essentially trying to achieve a lastIndexOf. I do that by reversing my array, using indexOf, and subtracting from 9. This adds 4 (9
W
%
-
) extra bytes to get from indexOf to lastIndexOf.
Furthermore, if I didn't know my array was length 10 the code would be even longer, and secondly, this code returns 10
when indexOf is -1
which may not be acceptable in many situations.
Any suggestions on a shorter way to do the lastIndexOf operation (generally or just as needed for this challenge)?
I want to ask the same thing, but in [tag:pyth] :P – Mr. Xcoder – 2017-07-15T14:51:28.370
@EriktheOutgolfer Thanks, I changed it to shorter. And I'm interested in solutions for any of the cases: 1) my challenge 2) variable array length 3) -1 case. – geokavel – 2017-07-15T19:02:46.187
@geokavel OK, posting mine as an answer for 3) then. :) – Erik the Outgolfer – 2017-07-15T19:03:26.820