# Coding Interviews: Common Algorithms

I previously wrote about some common coding algorithms that you’ll run into on your job search. The article was received fairly well so I thought I’d do a couple more to help in your journey to becoming more familiar with algorithms.

I previously wrote about some common coding algorithms that you’ll run into on your job search. The article was received fairly well so I thought I’d do a couple more to help in your journey to becoming more familiar with algorithms.

## CHUNKS

With this problem, you’ll be given an array and a chunk size. You’ll need to divide the array into subarrays that are the length of the chunk size and returned as a new array. In this exercise, we’ll be using a while loop as well as the array methods push and splice. Since we’ll be placing the subarrays into a new array, let’s go ahead and create an empty array at the top of our function.

Now, let’s think about what we’re looking for. We want to create new arrays that are the length of the ‘size’ argument. So let’s cut the array into the size we want using the ‘splice’ array method to see what’ll happen.

Please be careful with the ‘splice’ method as it can also be used to replace items in an array. Click the linked article to read more about that process.

As you can see in the terminal, we now have an array that has a length of 2, starting at the zero(0) index of the ‘arr’ variable on line 16. This is great but we still need the rest of the array AND to have it returned within a new array.

One way we can get the rest of the original array is to the splice the array while counting the length of the array.

Alllllmost there

Nice One! The final step to this problem is pushing the results of our while loop/splice into the ‘arr2’ variable that we created earlier. The push method pushes an item to the end of the array that it is called on.

You’re a coding wizard, Harry

Take a quick break for some water and snacks, then we’ll jump into the next problem.

## Coding Interviews: Common Algorithms

Today I am going to be sharing two common coding algorithms as well as their solutions and some links to resources that will help you expand your knowledge of algorithms.

## How to Prepare for a Coding Interview in 8 Weeks

As of this writing, the market is tough. We’ve been hit hard with a deadly pandemic that left thousands of people unemployed. It’s layoffs everywhere and the companies are being conservative when it comes to hiring.

## Some Non-Code Tips For Coding Interviews

The interview isn’t only about algorithms. Some Non-Code Tips For Coding Interviews. Coding interviews are hard, and algorithms are probably the hardest part. However, it’s not just about knowing the answer, a lot of interviewers are looking at how you tackle the problem. After talking with a lot of seasoned devs, here are some of the things that they look for when interviewing candidates.

## 7 Tips to Write Clean JavaScript Code

Who Else Wants to Write Clean JavaScript Code? In this Javascript tutorial, you'll see 7 Tips to Make Your Coworkers Fall in Love With Your Code.

## 4 Ways You Can Get Rid of Dirty Side Effects for Cleaner Code in JavaScript

4 Ways You Can Get Rid of Dirty Side Effects for Cleaner Code in JavaScript. Bugs are born in many ways. Creating side effects is one of them. Some people say side effects are evil, some say they’re not.