Home > Web Front-end > JS Tutorial > body text

Level Up Your Interview Game with Practice Problems

WBOY
Release: 2024-08-21 06:18:02
Original
1064 people have browsed it

Level Up Your Interview Game with Practice Problems

Introduction

To those who don't know me, I'm a Frontend Engineer with 10+ YOE who also created BigDevSoon - SaaS (next-gen code learning platform where you learn by building stuff from Day 1.) 10k+ users soon/$1k MRR this month.

Even tho I'm enjoying building modern UIs in React, the transformation of the "Frontend" role over the years forced me many times to be a Full-Stack dev, create BFFs (Backend for Frontend), analyze and think through tons of data structures and work with databases. In other ways, we're no longer "Website" Developers and to keep up the pace, we need to learn and adapt all the time.

In today's tough market times, it took me more than one month to land my latest job, you can read about this journey here. By grinding marathon-like interviews with often 10+ stages I understood the new patterns and how we need to adapt to land jobs easier.

One of the patterns I noticed is communication and soft skills, e.g. "Record your welcome video and tell us something about yourself." or 3x+ behavioral/cultural interviews "What would you do in x situation and why, explain." but it's a topic for a different day which I won't be covering in this post.

Only one thing I'll mention for the above and it's worth doing if you're not an "influencer" yet, is trying to record yourself and even attempting to do a demo feature you created, a side project, or introducing yourself and your career (e.g. summarize your resume, experience, past projects in max. 3-5 minutes). You'll listen to this and maybe figure out that your voice is too quiet or you're stressing too much in front of the camera. It's a good exercise to overcome that fear and imagine striking through 9/10 stages and failing to talk with a CEO/TL/Manager just because you didn't practice that. It would be a pity.

Another topic is well-known practice problems but trust me, you don't need to master the whole DSA including things like Dijkstra's algorithm or Red-black trees (even tho it'll be helpful to ace your next interviews).

All it takes is a little bit of grind and preparation so you won't get caught off-guard and can solve these "little problems" that many companies use these days to filter out the candidates and not waste time on long interviews by investing their resources (e.g. people who need to interview and so on)

What many "Waterfall" Devs after boot camps/courses lack is problem-solving skills, these programs often take you by the hand and don't allow thinking on your own that much - not saying it's wrong but to become better many different techniques are needed and for acing interviews under pressure, it's a huge difference maker to be able to quickly come up with solutions to problems you acknowledged 10 minutes ago and interviewers expect it to solve in less than one hour.

Let's learn more about this from one of the examples I experienced, and then I'll share a daily habit that helped me in my interviews and present some worthy problem-solving practice problems.

The Palindrome Problem

So a palindrome is a value that reads the same from backward or forward. E.g. racecar is a palindrome but hello is not a palindrome as when you reverse that value it'd be olleh instead.

I'm on a call with a recruiter from one of the companies I was applying for and we have that chill small talk as it was one of the first stages in that company. And now BOOM, last 10 minutes of the interview "Hey, one last question, could you write a code solution for the palindrome problem?" ... and I was caught off-guard a little bit.

But we got this, jumping into https://jsfiddle.net/ instantly and writing:

function isPalindrome(string) {
  return string.split('').reverse().join('') === string;
}
Copy after login

Proud of myself, but the recruiter says "Please don't use built-in methods.".

Ok, no problem at all, we're running out of time soon but I got this.

Spend some time to come up with a silly solution, something like this:

function isPalindrome(string) {

  let isValid = true;

  for (let i = 0; i < string.length / 2; i++) {
    if (string[i] !== string[string.length - i - 1]) {
      isValid = false;
    }
  }

  return isValid;
}
Copy after login

and of course, the recruiter started talking about Big O notation. We talked some more and I was busted, caught off-guard again.

Let's say an acceptable solution would be something like this:

function isPalindrome(string) {
    const normalizedString = string
    .toLowerCase()                    // Convert to lowercase
    .replace(/[^a-z0-9]/g, '');       // Remove non-alphanumeric characters

  for (let i = 0; i < normalizedString.length / 2; i++) {
    if (normalizedString[i] !== normalizedString[normalizedString.length - i - 1]) {
      return false;
    }
  }

  return true;
}
Copy after login

We do 2 things here, first, we normalized a string so for A man, a plan, a canal: Panama we get amanaplanacanalpanama and we quit the loop early rather than always iterating through "half through string value".

It's just an example but let's learn what happened wrong.

  1. Lack of communication, I didn't even ask if the recruiter meant pseudo-code, wanted to make strict types like TypeScript, or if fiddle was the proper choice.
  2. I didn't validate if could use Google/ChatGPT (well it was a super easy thing to solve but I had close to no time and after writing a one-liner I was distracted even more).
  3. I mentioned that my last solution could be improved but we didn't have time to write it down. Maybe it was a weird interview question to catch me in the end but by asking proper questions like "Can I use built-in methods, should I use a loop for it, should I write pseudo-code or a working solution, can I google/ChatGPT?" Would save me a lot of time for sure.

Lessons learned, I started my grind on leetcode. Always 1+ problem daily but mostly choosing from Easy/Medium difficulty and trying to focus on problems that "are a human nature" as recruiters usually use these, e.g. Best Time to Buy and Sell Stock I was given as a task in one of the next companies I was applying for and solved it. I like to ask ChatGPT about the company I'm applying for and to recommend practice problems that could be relevant, even adding some message from the recruiter as an additional context. (Yes, you could ask them through an email what to expect during the interview if they don't explain it too well).

After some time you'll start seeing patterns, Array problems, String problems, connecting pieces, and getting better at it as the methods you use for solving these problems can be shared even if the test cases differ or the problem nature is completely different.

Problems worth checking out

As we're adding more and more features to our platform, I'll do a shameless plug ahead with Practice Problems on BigDevSoon, 41 of them right now, trying to keep things simple (KISS) and curate the most relevant problems + a few more for warming up (Easy level).

I'm listing 10 of them below that I find worth solving.

1. Palindrome

2. Find Max

3. Best Time to Buy and Sell Stock

4. Container With Most Water

5. Count Vovels

6. Group Anagrams

7. String Compression

8. Subsets

9. Top N Frequent Words

10. Find All Duplicates in an Array

Summary

And that's it! There's a ton to learn from these practice problems each being a fun way to activate your brain.

It's been my goal for a long time to spread a project-based learning approach through the community and have BigDevSoon up and running, an app we've been working on for the last 3 years. It's a great achievement for us.

Keep codin' BIG! ?‍♂️

The above is the detailed content of Level Up Your Interview Game with Practice Problems. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!