r/programming • • May 08 '15

Five programming problems every Software Engineer should be able to solve in less than 1 hour

https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour
2.5k Upvotes

2.1k comments sorted by

View all comments

Show parent comments

1

u/Zequez May 08 '15

I think you meant:

['+', '-', ''].repeated_permutation(8).each do |perm|
  sumText = ('1'..'8').zip(perm).flatten.join + '9'
  puts "#{sumText} = 100" if eval(sumText)
end

Because otherwise, sumText doesn't exist to write it out.

1

u/musicmatze May 08 '15

Oops. Yes, indeed. I'm sorry.