DEV Community

Cover image for How I Finally Learnt to Solve Coding Interview Questions
Cathy Lai
Cathy Lai

Posted on AI-assisted

How I Finally Learnt to Solve Coding Interview Questions

Uses AI and self-recording for prep

So you have an algorithmic coding interview coming up... You know the standard advice: think out loud, talk as you code, and don't worry about optimizing right away. But what does that actually look like in practice? And how do you prepare for it effectively when time is short?

Preparation

Should I start cramming LeetCode problems? Doing that felt like jumping into the deep end, which would only shatter my confidence. An interview won't go well if you feel insecure before it even starts!

Instead, I started with easy, AI-generated exercises and gradually built up the complexity. ChatGPT is great for that. I aimed for 2 to 3 problems a day, depending on the difficulty. This turned out to be a fantastic approach. I could feel myself improving with every problem, learning at a comfortable pace rather than feeling overwhelmed.

With each exercise, I tried to pinpoint the specific friction points that kept me from solving it smoothly:

  • Not fully understanding the problem before writing code
  • Writing too much code in one go without testing
  • Struggling with self-doubt midway through
  • Getting embarrassed when a bug appeared—and figuring out how to recover gracefully

I even recorded myself during a few sessions and watched the footage back to evaluate my pacing, explanations, and overall presence.

Developing a Rhythm

Through this process, I discovered a working rhythm that keeps me grounded:

  • Clarify assumptions: Write down all assumptions upfront.
  • Verify the setup: Create a dummy function first to print a test output and ensure everything is running.
  • Trace the algorithm manually: Walk through the example input step-by-step to identify every variable needed across iterations.
  • Talk through roadblocks: If I get stuck, I state what I'm trying to solve out loud (e.g., "Do I need a flag here? A running total? Is this tracked per group or across all groups?").
  • Validate the logic: Work through the example input again to confirm variables are being set, reset, or accumulated correctly. Keep tracing until the manual steps produce the expected result.
  • Start coding: Only write code once the logic is proven—this prevents getting bogged down in syntax while still problem-solving.
  • Expose your mental model: By this stage, the interviewer has a clear view of your thought process, as the pseudo-code and variable state tracking are already on the screen.
  • Test incrementally: Print debugging statements early and often to monitor key data structures in real time.
  • Embrace simple debugging: Don't hesitate to use simple print statements. Catching a bug early prevents unexpected output later, which can throw off your composure.
  • Stay calm when bugs happen: If unexpected output pops up, treat it like a regular ticket you're fixing during a normal workday. Framing it as everyday work helps keep your nerves in check.

How About You?

If you are also preparing for interviews, hope these help! What are your tips? Please comment and share :)

Top comments (9)

Collapse
 
francistrdev profile image
FrancisTRᴅᴇᴠ (っ◔◡◔)っ

I would say if you are practicing technical interviews, although GPT and recording yourself is helpful, see if you can find a person that has been in the job for a long time to practice with. You get even more insights on their feedback since they have been in the process before and will provide you really helpful tips on solving problems. Even better, a good practice on behavior interviews as well and things to look for. Thanks for sharing Cathy!

Collapse
 
cathylai profile image
Cathy Lai

Yes that is a great tip. Having a person next to you to watch you will really help a lot! Especially another senior engineer who has hired someone before.

Thanks for your encouragement!

Collapse
 
blobdole profile image
Doug

I have been looking at using AI agents to pick up new programming languages, and to focus in on learning specific engineering areas and topics.

How have you been prompting it to give you exercises with progressing complexity/difficulty? Because my experience so far is that it is pretty spotty in terms of difficulty progression and REALLY struggles to keep the tasks limited to the concepts I have already been taught.

Collapse
 
cathylai profile image
Cathy Lai

Hi! Yes, using AI to study a language is a great method—it's a very patient teacher! 😄

When practicing interview questions, I start with the simplest one first. (I use ChatGPT Plus).

  • I keep all my questions organized in a project.
  • I make sure to start a new conversation for each coding question.
  • I copy and paste my solution for ChatGPT to critique.
  • It learns what I did wrong and understands where I struggled.
  • For the next question, it takes those insights into account.
  • I also prompt it with my desired difficulty level.

I find this approach works really well! After a few repetitions, it gets pretty smart at tailored question generation.

Hope this helps!

Collapse
 
codingwithjiro profile image
Elmar Chavez

As someone who records himself and rewatches the recording to critic it, I approve of this. The list you gave is so true and I can attest to that. I've been constantly improving myself by explaining my thought process ever since early February this year. Also the output printing for every step is so relatable. I do mine by printing it every time in the console using console.log() (that's why I always use VS code to easily see the output in the terminal whenever I do coding challenges.

There's one thing I want to add though. The platform where I'm doing these coding challenges is CodeWars and after completing a challenge, the site would allow me to see other people's solution. This is where I practice reading other people's code and explaining it out loud too. I also point out good and bad practices used as if I am explaining it to a co-developer. I think this helped me a lot too so if you ever got a chance to see other people's approaches, you can do this method as well (I only review one everyday and for me that's already a huge game changer).

PS. Just finished recording my daily challenge today!

Collapse
 
cathylai profile image
Cathy Lai

Thank you so much for sharing your experiences😀! It’s encouraging to hear that recording yourself and explaining your thought process has helped you too.

I really like your idea of reviewing other people’s solutions and explaining their choices out loud as if speaking to a co-developer. That adds another important skill: learning to read, evaluate and discuss unfamiliar code—which is very relevant to real interviews as well. I definitely will give that a try and share it here.

Congratulations on finishing today’s recording too! 👍

Collapse
 
mikachu profile image
Mika Flowers

Fantastic advice. Building healthy habits around the technical side of problem-solving really helps too!! especially when it comes to staying consistent under pressure.

Collapse
 
cathylai profile image
Cathy Lai

Very important point! Go for walks before I attempt these coding exercises seemed to really help 😀

Some comments may only be visible to logged-in visitors. Sign in to view all comments.