What I learned from writing six functions that all did the same thing
Jackson Bates
1K36

When I was doing my CS degree, we were assigned to write a program to solve Peg Solitaire. I spend a couple of evenings working on the problem and came-up with a decent solution that seemed to scale well with input size. I was feeling pretty good about how things were going.

The day before the assignment was due I was at the lab, putting on the finishing touches before sending it in. My friend sauntered in around 21:30. He said hello, logged in, and sat there silently staring at the screen for a while, sipping his coffee. He then wrote what must have been around 50 lines of code and said “Well, that’s that!”

His solution was about 1000 times faster than mine. It also took him about half an hour.

I felt embarrassed at how much more effort it took me to come-up with something that was just adequate. But I was also really proud of my friend to have come-up with such an elegant solution so quickly!

There will always be people smarter than you. That’s why working in teams is a good idea. Also good are practicing humility and celebrating opportunities to learn from your peers.

Thanks for a great write-up!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.