Technical Interview: Create a function that inserts a dot (".") between each character of a string. There shouldn't be a dot at the beginning or the end of the string, just in between characters.
Anonymous
Straightforward 1-liner solution using ruby array library: def insertDots(str) if (str != '') str[0] + str.split('')[1..-2].map{|a| a.to_s + '.'}.join('') + str[-1]; end end insertDots('adddots'); Cheers!
Check out your Company Bowl for anonymous work chats.