4 ms·
Nice! Here are some J solutions. Unfortunately, I only have time for a few, right now. Hopefully, I can add some more later: 'mississippi' +/@:= 's'
by xelxebar 7y ago
Nice! Here are some J solutions. Unfortunately, I only have time for a few, right now. Hopefully, I can add some more later:
'mississippi' +/@:= 's' NB. 0 - Multiplicity
(-:|.) 'racecar' NB. 1 - Trapeze Part
(~. #~ 1 < +/@|:@=) 'applause' NB. 2 - Duplicity
'teapot' -:&({~/:) 'toptea' NB. 3 - Sort Yourself Out
(~. #~ 1 = +/@|:@=) 'foo bar' NB. 4 - Precious Snowflakes
- xelxebar 7y agoJust for posterity, here are the rest I came up with: 'foobar' (e. ] A.~ +/@(!@i.@- *&|: >:@i.@- $&> i.)@#) 'barfoo' NB. 5 - Musical Chars (/: #&>) 'books';'apple';'peanut';'aardvark';'melon';'pie' NB. 6 - Size Matters (~. #~ [: (= >./) +/@|:@=) 'abdbbac' NB. 7 - Popularity Contest |.&.>&.;: 'a few words in a sentence' NB. 8 - esreveR A ecnetneS 'foobar' #~ 1 0 0 1 0 1 NB. 9 - Compression Session 'fbr' [`(I.@])`($&'_'@#@])} 1 0 0 1 0 1 NB. 10 - Expansion Mansion '_'&(I.@e.&'AIUEOaiueo'@]}) 'FLAPJACKS' NB. 11 - C_ns_n_nts -.&'AIUEOaiueo' 'FLAPJACKS' NB. 12 - Cnsnnts Rdx 'one fish two fish' [`($&'X'@#&.>@[)@.e."0 _&.;: 'fish' NB. 13 - TITLE REDACTED (A.~ i.@!@#) 'xyz' NB. 14 - It's More Fun to Permute Note that 14 is trivially non-recursive. I am fairly happy with these solutions, especially 5 and 13 which took the most thought.