Skip to main content
added 281 characters in body
Source Link

Ruby 1.9, 77 48 4646 44 chars

r=->w{w[1..-2]=[*w[1w[h=1..-2]2]=[*w[h].chars].shuffle*"";w}

Disclaimer: I tuned this based on the highest ranked answer - noticed the exact same answer later on. You can check the history that I have kept true to my original idea but changed from ruby 1.8 to ruby 1.9 for short lambdas and shuffle.

If empty words are allowed then 5656 54 chars

r=->w{w.empty?||w[1..-2]=[*w[1||w[h=1..-2]2]=[*w[h].chars].shuffle*"";w}

Ruby 1.9, 77 48 46 chars

r=->w{w[1..-2]=[*w[1..-2].chars].shuffle*"";w}

If empty words are allowed then 56 chars

r=->w{w.empty?||w[1..-2]=[*w[1..-2].chars].shuffle*"";w}

Ruby 1.9, 77 48 46 44 chars

r=->w{w[h=1..-2]=[*w[h].chars].shuffle*"";w}

Disclaimer: I tuned this based on the highest ranked answer - noticed the exact same answer later on. You can check the history that I have kept true to my original idea but changed from ruby 1.8 to ruby 1.9 for short lambdas and shuffle.

If empty words are allowed then 56 54 chars

r=->w{w.empty?||w[h=1..-2]=[*w[h].chars].shuffle*"";w}
bug in latter
Source Link

Ruby 1.9, 77 48 46 chars

r=->w{w[1..-2]=[*w[1..-2].chars].shuffle*"";w}

If empty words are allowed then 4956 chars

r=->w{w||w[1w.empty?||w[1..-2]=[*w[1..-2].chars].shuffle*"";w}

Ruby 1.9, 77 48 46 chars

r=->w{w[1..-2]=[*w[1..-2].chars].shuffle*"";w}

If empty words are allowed then 49 chars

r=->w{w||w[1..-2]=[*w[1..-2].chars].shuffle*"";w}

Ruby 1.9, 77 48 46 chars

r=->w{w[1..-2]=[*w[1..-2].chars].shuffle*"";w}

If empty words are allowed then 56 chars

r=->w{w.empty?||w[1..-2]=[*w[1..-2].chars].shuffle*"";w}
empty word version
Source Link

Ruby 1.9, 77 48 46 chars

r=->w{w[1..-2]=[*w[1..-2].chars].shuffle*"";w}

If empty words are allowed then 49 chars

r=->w{w||w[1..-2]=[*w[1..-2].chars].shuffle*"";w}

Ruby, 77 48 46 chars

r=->w{w[1..-2]=[*w[1..-2].chars].shuffle*"";w}

Ruby 1.9, 77 48 46 chars

r=->w{w[1..-2]=[*w[1..-2].chars].shuffle*"";w}

If empty words are allowed then 49 chars

r=->w{w||w[1..-2]=[*w[1..-2].chars].shuffle*"";w}
Splat
Source Link
Loading
Source Link
Loading