LeetCode Problem Of The Day

Over the past couple of years I have adopted a habit of completing the LeetCode “Problem of the Day” each morning, often as the first thing I do when I wake, or at least before I start work. I love this and it has made me much faster and more confident about the type of algorithms and data structures questions that frequent software engineering interviews.

Technically, LeetCode calls these “[Month] LeetCoding Challenge [Year]” as the screenshot I captured shows. The idea is to solve each problem on the calendar day that LeetCode posts it, and build a streak of consecutive days that I’ve solved the daily problem.

LeetCode being a business, they also sell “time travel certificates” that allow me “travel back in time” to solve a past day’s problem and keep a streak alive. They also provide one extra weekly problem to paid subscribers. I believe you can’t technically complete the monthly streak unless you become a paid subscriber and solve those.

I don’t worry about the streak mechanic, although I certainly don’t begrudge LeetCode the attempt to generate some cashflow from the service they provide. Sometimes I miss days, either because of travel or family or because the problem is legitimately too hard for me to solve. I just pick up the next day.

One of my favorite aspects is reviewing the official Solution explanation, or the user-generate discussion thread, after I’ve solved a problem myself. I gain a lot from reviewing other users’ code and comparing their solutions to mine, especially when my solution works but is slow. LeetCode times submissions and shows the result, unless the code is so inefficient that it triggers a “Time Limit Exceeded” error.

The rhythm of solving one data structures and algorithms problem every morning is a terrific routine for programming practice. There’s obviously a lot more to software engineering than compact, competitive programming-style and interview-style challenges. But I always feel like a musician practicing scales or a basketball player practicing free-throws – hardly the entire repertoire of the craft, but nonetheless a valuable way to practice by myself and develop skills that translate to other parts of the domain.

One thought on “LeetCode Problem Of The Day

  1. Hello David, maybe you could record yourself solving these questions. It would help a lot of us newbies to think the right way and approach a problem in a more efficient manner. It would definitely help in the interviews. Hope to see one of your recordings soon.

    Like

Leave a comment