Code Golf at Google

  • Fun fact: there has been a problem with Googlers calculating hash functions that pass all the test cases for certain questions.

  • i think the sad pattern I see in a lot of these code golf implementations is the solution score is based on Lines of Code, which we already agree is a POOR representation of either complexity or simplicity.

    I think it would be far more interesting to measure number of instructions to complete the objective. Though I suspect the folks familiar with assembly would run circles, perhaps you could segment by solution language?

  • Hah, I remember spending hours on this during work hours when I was interning last year. I used to come up with very clever and short solutions only then to find out I wasn't even top 10 :(

  • Perl is a way more fun for golfing but it's missing from the supported languages

  • I had to do a code test for a job (sigh). But it actually was kind of fun. The website takes your code and checks correctness and efficiencies.

    The company posts "challenges" every month. But they also have lessons which contain some interesting code challenges. The only problems is 1) they're timed 2) sometimes the descriptions are kinda mathy which may put people off.

    https://codility.com/programmers/lessons/

  • Can a googler put the questions in public for others to see?

  • I'm trying to run the c++ version, but it won't compile because the loop variables in the range for loops do not have declarations.

  • My Goog code golf examples were marked down because I didn't insert the method call to sellAdsToSuckers() call everywhere!

  • >http://go/codegolf

    How does this work, some sort of TLD magic? (That shouldn't be possible, right?) Is it just routed within Google's internal network?

  • I watched the wolf of wall street recently. I see some of the solutions to these code golf exercises as similar to the bankers who beat their chests and celebrate their masculinity in selling penny stocks to gullible investors.These code golf exercises seem like the software developer equivalent: "look at how brilliant and superior I am that I can obfusicate code into something no-one understands in only 2 lines".

    My concern here is that this Code Golf mentality infects the normal day-to-day coding at Google. Just because an implementation can spawn a few lines it doesn't make it a good implementation. What about clean code, maintainability, automated testing, self documenting code...

    I pity the codebase I would have to maintain from one of these code golfers.