Post Reply 
HHC 2016 RPL Programming Contest
09-20-2016, 12:41 AM
Post: #17
RE: HHC 2016 RPL Programming Contest
(09-19-2016 11:43 PM)Juan14 Wrote:  I initialized the distance to zero, then with a FOR-NEXT loop, get the distance from each letter to it's first appearance in the string (using the SUB command and POS command) and then use MAX to keep the maximum distance.

«
0 1 PICK3 SIZE
FOR j
j PICK3 DUP j j SUB POS - MAX
NEXT NIP
»

(palm slaps forehead, and then the following thought...)

This is great, Juan. 60.5 bytes! You could even save 2 more bytes by using "j DUP SUB" instead of "j j SUB". Very nice!
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HHC 2016 RPL Programming Contest - Gene - 09-17-2016, 01:39 PM
RE: HHC 2016 RPL Programming Contest - DavidM - 09-20-2016 12:41 AM



User(s) browsing this thread: 1 Guest(s)