Electric Banana Band reminds us of why we are here

The Swedish kids know the songs. The parents know the songs. The grandparents know the songs and I think even the great-grandparents knows the songs. For 37 years Electric Banana Band has provided…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How to Ace a Coding Technical Interview

I recently graduated from a coding bootcamp. One of the perks that my bootcamp granted us was a free mock technical interview. This would be a one-hour session over the computer where you live code with an interviewer. Here are some tips I discovered to do your best in any technical interview.

First, be prepared to answer some basic questions regarding the principles of your language. I had my interview in JavaScript, and I was asked “What is a prototype?”, “What is inheritance?” and “What is closure?” Some other questions that have been known to be asked for JavaScript interviews are “What is the difference between var, let, and const?”, “What is the difference between an object and a class?”, “What is hoisting?” and “What is the keyword ‘this’?”.

Next, review some basic computer science concepts, such as data structures and Big-O notation. These could come into play in your technical interview.

For better or worse, most technical interviews are algorithm-based. I would highly recommend practicing as many algorithm problems as you can before your interview.

Okay, it’s interview time. You think you’ve studied enough. You’re nervous, obviously. Take a few deep breaths. Eat something. Try to stay calm and focused.

The biggest tip I can give you while you’re in the interview: KEEP TALKING. It doesn’t matter if you’re completely stuck, if you have no idea what you need to do, just don’t stop talking. Communicating with the interviewer what your thought process is shows them what your problem solving skills are like. Talk about what you think is going on. Throw out ideas on different ways you can think of solving the problem.

As you talk about your process, start pseudo-coding. If you already know the answer, feel free to skip this step, but it is a good way to get your brain in gear when you’re absolutely stuck. Write the outline of what you think you need to do to solve the problem. Then slowly get more specific as you begin to think of more concrete ways to get the solution you need.

Your interviewer is there to help you, not stump you. In my particular interview, I didn’t remember a specific JavaScript method I needed to solve the problem. I described what I thought it was and my interviewer supplied me with the answer.

If you’re allowed: Google for the solution. In some interviews, Googling is completely allowed. Use this to your advantage.

No matter what you do, try to remain calm throughout your process.

Here’s the big algorithm problem I was given:

Given an array of nested arrays [1, [2, 3], [[4]], 5, [[[6]]]], how would you write a function to flatten it without using the flat method?

Here’s my solution:

JavaScript code for flattening an array with recursion

How did I go about solving it? I started talking out what I was thinking. I would need a loop to iterate through the array, so I created a for loop. I know I would need an empty array to push the elements into, so I created one. In each iteration of the loop, I pushed an element into the new array. Then I realized that I would need another loop inside of that array if the element I wanted was an array itself. This means I had to create a loop for each level of nesting for each element.

The solution? Use recursion. When you create a function that does the main work for you, you can call that function inside itself. The important part with recursion is to have a good stopping point. You don’t want an endless loop. I did this with my if statement: if the element is an array, flatten it again by running this function over; if not, push the element into the new array.

My interviewer’s follow-up question was: how would you solve this problem without recursion? I wasn’t able to answer this at the time, but since then I’ve researched the answer.

This was my favorite answer:

JavaScript answer for flattening arrays without recursion

Some other example algorithm questions include “Return the nth number of a Fibonacci Sequence”, “Have the function FirstFactorial(num) take the number parameter being passed and return the factorial of it. For example: if the number equals 4, then your program should return (4 * 3 * 2 * 1) = 24” and the classic FizzBuzz: “Write a program that prints the numbers from 1 to 21. For multiples of three, print “Fizz” instead of the number. For multiples of five, print “Buzz” instead of the number. For numbers which are multiples of both three and five, print “FizzBuzz”.”

Keep in mind, these questions may vary based on language being tested on, company being hired for, and the position.

Hope this helped!

Add a comment

Related posts:

What has been taught

Everyone has made excuses for things in life. “I couldn’t pay the bill because I didn’t have the money.” But did you go out and push for a new client? Drive Uber? Really work to get that paid? Did…

Are Poor Grades Correlated with Bad Teacher Performance?

Originally published here — https://twosigmas.com/blog/are-poor-grades-correlated-with-bad-teacher-performance/ There are few greater responsibilities that a parent and even society as a whole have…

Why Social Media Marketing Is Important For Your Business?

Own a business and considering social media marketing, but are unsure about whether it would benefit you? While social media is key for most brands in this age of technology. Do we really know what…