Monday, February 21, 2011

I feel dumb

I thought I was all cool for solving these (well, newbie cool). Looking at the forums for the problems I realize how heavy handed my approach is! Maybe some day I'll circle back and make my code more efficient.

One example with the Fibonacci problem is that it seems every third term (and only every third term) in the sequence is even. My "are you even?" check wasn't necessary if I had just ran the sequence through a few more terms per loop and added the result.

I'm not sure I'd have EVER noticed that!

There were more complicated ways to make the code faster and more graceful, but they're a bit over my head right now.

No comments:

Post a Comment