Mastering Data Structures and Algorithms with LeetCode, ChatGPT, and Python.

Relatable tales of coding frustration — and success.

Daniel Gil
5 min readOct 13, 2023

I’ll make a series of stories in which I share my process of mastering data structures and algorithms primarily through tackling LeetCode problems with a somewhat heuristic script I designed for selecting the next most appropriate question for me to tackle every time and ChatGPT-Plus as an instructor.

I want every story to delve into a specific problem, exploring not just the solution but also the entire thought process I went for.

As people read I hope they are able to witness a blend of challenges, breakthroughs, insights, and strategies, all anchored in real-time learning experiences I have already had and will be having.

I’ll not write super technical guides but more like windows into the genuine struggles and victories of an actual self-thought programmer striving to hone his skills. I hope some of you guys care to stay tuned to see this constructivist set of iterations between theory and practice I’ll be sharing.

Gpt 4 + Dall-E: “Make me an image to place as a story preview for this medium story {full story}”

Motivation and Vision

Bridging Multiple Aims

I had an idea for hitting many birds with one stone in the process of preparing for job interviews.

Associated with getting into the industry comes the need to recognize the importance of working on projects, and their showcases, networking, learning new tech, and new skills, sharing content, and helping others.

Not only is it kind of hard to hit a strategy to do a thing for everything simultaneously, but doing so is also strongly advised against.

I decided instead to fuse all of these purposes into a single activity that encompasses everything to one degree or the other.

Why Publish? The Multifaceted Purpose

The rationale behind it has multiple purposes. Primarily, by publishing, I want to revisit and consolidate my understanding, help others do the same, form an online presence, and stimulate interactions that could potentially lead to job opportunities.

ChatGPT’s role

My experience with ChatGPT has been fundamental in this. Its ability to provide focused, tailored assistance at each step in understanding a problem has been like having a personal instructor with 24/7 availability.

The traditional route for learning these materials to a high level of sophistication in understanding often involves human instructors, teachers, mentors, and professors, but with ChatGPT, the learning experience becomes more dynamic, super specific, and accessible, making it an invaluable asset for a lot of us.

Content Overview

Constructivist Approach

Now, about the content. The entire series of stories will be a detailed exploration of my constructivist approach to learning data structures and algorithms with ChatGPT and Leetcode problems. Every article is dedicated to one problem.

Breadth Before Depth

Is interesting that I think now about a “breadth-before-depth” approach to describe it. What I initially figured out had to use LeetCode for was a high-level exploration of the contents there are to learn. A sentiment better encapsulated in the adage: “The more I know, the more I realize what I don’t know.”

I endeavored to map out the landscape of topics available on LeetCode. I initially plugged into a Third-party Python library for connecting to Leetcode and downloaded all the question titles with some of their data, then made a Django script with which I sifted through various questions, progressively covering a high-level theoretical understanding of the full range of tag topics with like 40 initial questions that shed light on the most recurrent themes.

Given that LeetCode’s questions are pretty much reflective of real-world interview questions, coupled with ChatGPT’s role as a diligent learning partner, I found on LeetCode’s testing platform a way of directly testing the assumptions generated with ChatGPT, to a great degree avoiding known problems with LLM hallucinations.

A query to GPT-4, asking about the concept “Strongly Connected Component” on LeetCode. Following the question, there’s a detailed response explaining the concept (yes, GPT wrote this).

Target Audience

Who Should Read This?

I’ll aim these at people who have some foundational programming experience and are seeking a comprehensive and structured pathway to understanding data structures and algorithms in a somewhat structured, very much targeted (to real-world technical interview questions as found on Leetcode), and easy-to-set habit of implementing manner.

I wouldn’t say I can provide something at a level for absolute beginners, nor super interesting for more seasoned engineers and such.

It’s for those who, like me, are in the middle of their learning experience and are searching for a relatable, real-time chronicle of mastering Data Structures and Algorithms they can use to directly learn from but also replicate and guide their efforts with.

Content Structure and Approach

Tackling Problems

I plan to have each thread or article tackle an individual problem that I confronted myself, and to go on to describe how I did so, but also to link them and organize them naturally with the overlapping tags and topics that leetcode assigns to questions, in addition to a mix of their difficulty and other information.

I want to delve into the intricacies of my interactions with each problem, discuss the nuances, and in particular share some of my real interactions with ChatGPT during this process. Obviously not just about presenting solutions but about grappling with the problems, the thought processes involved, and the insights gained along the way.

Personal Touch

How is this any different from the amount of DS&A resources out there?

For one, it’s deeply personal.

It’s a genuine reflection of my experiences and insights. The content isn’t just about algorithms or code; it’s about the human element of learning, the struggles, the eureka moments, and the iterative process of understanding.

I want readers to not only learn from the content but to also resonate with the reality that permeates each story.

Engagement and Community Building

Active Engagement

As feedback and engagement are crucial for both the sake of the material and my initial intentions, I plan on publishing these stories on different active platforms to foster interaction.

I guess at times I’ll add calls to action, inviting people to help understand, provide resources, and share their thoughts, critiques, and insights. I’m also toying with the idea of establishing a GitHub repository for them, potentially transforming it into a collaborative hub for learning DS&A, who knows?

The Role of Feedback

I believe in the value of transparency. I’m not an expert. But in this context, I think that’s actually an advantage in order to relate to others.

It’s essential to acknowledge the gaps in one’s understanding, and I see these gaps not as shortcomings but as opportunities. As this stuff takes off, I hope it becomes evident that this isn’t just about DS&A but a chronicle of personal growth, resilience, and the pursuit of knowledge we all want and need in our careers.

Looking Ahead

In the long run, I envision this evolving into a comprehensive guide, tracing a meticulously mapped path through the vast landscape of DS&A topics.

I’ve also contemplated a few additional projects along this, particularly centered around the Django script I developed for navigating LeetCode and possibly diving into data visualization with the ChatGPT conversations, the problems solved, stories published, and general engagement. All topics I’m deeply interested in.

--

--

Daniel Gil

I strive to make the content I wish the internet already had —wanted to write something pretentious about liking coffee but just couldn’t stand it.