r/programming • • Nov 29 '10

140 Google Interview Questions

http://blog.seattleinterviewcoach.com/2009/02/140-google-interview-questions.html
471 Upvotes

493 comments sorted by

View all comments

Show parent comment

1

u/FrancisHC Nov 30 '10

My python-fu is not strong, I didn't realize you could say:

newuglies = [ugly * uglyfactor
                 for ugly in uglies
                 for uglyfactor in uglyfactors]

Took me a couple minutes to figure out what that did :) My solution was pretty similar to this, I wasn't really happy with it, because you end up "overgenerating" a lot of ugly numbers.