Hello,
Here is my solution. I made the assumption that the interviewer has a
terminal handy and I have 5-10 minutes to crank this out. If I was just
writing it down on paper, I made a note of a couple things that I got
wrong
before I had a chance to see the output:
for i in 1…101 # was 100 before checking this
out = ‘’
out = out + ‘Fizz’ if (i % 3) == 0
out = out + ‘Buzz’ if (i % 5) == 0
out = i.to_s if (out.size) == 0
print out + “\n” # Original did not have a newline
end
Thanks,
Justin