Coding Problems — How to Approach Them?

Nick Solonyy
Geek Culture
Published in
3 min readMar 29, 2021

I’m currently looking for my first coding job, and as a part of my journey, I came across solving coding problems. Unfortunately, I wasn’t aware that I should be getting ready for those during the Bootcamp. As I learned later, coding problems are a crucial part of tech interviews and I need to get myself ready for those.

The first resource I came across while review coding challenges was LeetCode. It’s a great resource that gives you a set of problems divided by categories, difficulty levels, etc. It also provides you an environment to code your solutions, test them and you can do it in different coding languages. So I started reviewing those that were tagged as Easy. A great thing that LeetCode also provides hints, discussions, and even explained solutions for some of the questions. Because as I started, it was tough to even understand how to approach them.

I came across the PEDAC method that was a great help for me to understand how to solve coding challenges. You can read a detailed explanation by launch school using the link above, but I would like to share some of the takeaways I got from learning this method.

PEDAC stands for:

  1. Problem
  2. Examples
  3. Data Structure
  4. Algorithm
  5. Code

Once you break it up like that each problem seems easier than when you look at it the first time.

Problem

I’ll be honest when I read some of the coding questions it takes me some time to understand what is needed. At first, I would suggest trying to rephrase a question using your own words. Make sure you have a clear understanding of 2 elements:

  1. Requirements
  2. Input and Output ( BTW LeetCode provides that information in a nice clear way)

Examples

When you understand your problem, it’s great to have a few scenarios to test your outcomes once you have your algorithm or code in place. Once again, LeetCode is great! In LeetCode you have samples ready for you and you can add more if you want. But when you’re solving a problem during a tech interview, you should be able to ask the interviewer: “What would the outcome be if my inputs are as follows?” So you come up with inputs and you get outputs from an interviewer.

Data Structure

Based on the issue at hand, you should be able to identify which data structure you can use to solve a problem. What would be a more efficient way to store data that you will get converting input to output. The most common types of data structures I’ve seen so far would be arrays and linked lists.

Algorithm

This is the most important part of the method, you should write pseudocode. You write down each step of the solution to transform input data into the final output. Keep in mind during an interview, interviewers want to see how you think and approach problems. So this is a perfect time to show your train of thought. When the algorithm is ready you should use your examples to make sure you’re getting expected results.

Code

Well, once you have your pseudocode handy and every step is recorded you should convert it into code. You can use any coding language you prefer, and you can google syntax if you’re not sure about something.

But as long as your algorithm was correct, you can always figure out how to code it.

Now your examples should work with your coded solution as well.

This is just a broad overview of one of the methods to solve coding questions. Recently I had few conversations with different people and heard great things about a book — “Cracking the Coding Interview”. I just got the book and will start reading it. In the future, I’ll try to give some insights into the book and other methods of solving coding questions.

Please check me out on the following social networks as well, I would love to hear from you! — LinkedIn, GitHub, and Facebook.

--

--

Nick Solonyy
Geek Culture

Full-stack software engineer with an international MBA. Project Management and Team Collaboration experience. React | Javascript | Redux | Rails