Posted on

Cracking the CS Code Interview With Javascript

For beginners getting a call for an interview is one of the most exciting experience, but these excitements get flushed once you fail in the initial rounds itself.

Any typical interview in javascript consists of a few rounds.

1. Phone call.
2. Initial screening.
3. Challenges on any coding website like Hackerrank, Hackerearth, Codechef.
4. Onsite Interview.
5. Offer.

Of these five rounds, the first two are not so hard as you just need to explain the interviewer your interests, your knowledge, and your capabilities.

But the third round is the gate pass for your onsite interview which can be game-changing, as now it is time to prove that you are truly capable of this role.

Yeah bring it on, I am ready!.😎.
This is what newbie feels sometimes, but hold on your are just going to be surprised 🎁.

You need to solve algorithms with all test cases to be cleared to make through this round (Also some other typical question depending upon the role you are interviewing for).

Now all the solved algorithm examples out there are either in Java, C++ or Python, But I only know javascript (Because I am a beginner)😔.

Don't worry Ant-Man is out from the Quantum realm and He is here to help you 🤷‍♂️.

Note: This list is for beginners only but others can learn from it too.

Arrays

Javascript Array Complete Reference.

Examples

How to reverse an array in javascript.

Number of subarrays with given sum k.

Find the maximum sum of products of two arrays.

Find the correct position to insert an element in the array.

Program to check if a subarray with 0 sum exits or not.

Check if an array is a palindrome in javascript.

Print all subarrays with a given sum k in an array.

Left circular rotation on an array of integers.

Right circular rotation on an array of integers.

Given an unsorted array of integers find a pair with given sum in it.

How to use array sort in javascript.

How to find elements with indexof in javascript.

Javascript get unique items from array.

String

Javascript String Complete Reference.

Example

How to reverse a string in javascript.

Reverse a string using a stack.

Reverse a string using recursion.

Count all substrings having character k.

Convert a string to uppercase in javascript.

Convert a string to lowercase in javascript.

How to find the substring in javascript.

Caesar Cipher in javascript.

Minimum characters to delete to make string anagram.

Check if two string are an anagram of each other.

Check if a string contains a substring in javascript.

Check if a string has duplicate letters.

Find missing alphabets to make a string panagram.

Palindrome string.

Count number of sub-string occurrence in a string.

Stack

Implement Stack In Javascript.

Example

Reverse a stack using recursion.

Sort a stack using another stack.

Balanced parentheses.

Convert decimal to binary, octal or hex in javascript.

Queue

Queue implementation in javascript.

Example

Program to reverse a queue.

Sorting

Example

Dutch national flag problem.

Selection sort in javascript.

Searching

Example

Linear search algorithm in javascript.

BitWise

Example

Program to add two binary numbers.

Swap two numbers without temp variables.

Maths

Example

Absolute difference between diagonals of the matrix.

Program to print all the prime numbers from 1 to 100.

Find the LCM of two numbers in javascript.

Program to find the GCD of two numbers in javascript.

Find distinct ways to climb the stairs in javascript.

Maximum Collatz sequence under 1000000.

Program to print the Collatz sequence in javascript.

Program to find the nth Fibonacci in javascript.

Print all the unique 2 digit combinations of given numbers.

Convert Roman numeral to an integer.

Factorial program in javascript.

Find the largest prime factor.

Program to check the prime number.

Find all the Armstrong number between two numbers.

Check if the given number is Armstrong in javascript.

Difference between the square of the sum of numbers and sum of the square of numbers.

Form the smallest possible number from the given number.

Buggy Calculator.

Find the digital root of a given number.

Find the biggest perfect square in an array.

Misc

Example

FizzBuzz program in javascript.

I started to share the solved examples in javascript only because I failed many interviews initially.

If you feel this is a helpful resource then please share these with others who are actively interviewing.

Also, follow me on Twitter for tips and tricks to solve the coding interviews and more solved examples of Algorithms. I write 2 - 3 post weekly on my blog learnersbucket.com.

Hello Prashant. Thank you for putting a list and sharing a lot of useful resources.

I unfortunately have to be in strong disagreement with the title of your article even though you are perfectly right that round 3 on your list is usually the gate pass to next steps.

What you have here might be better suite as "Cracking the CS Code Interview With Javascript", but IMO is not representative of what a "beginner" or any level of Javascript interview should be. There is a subtle but real difference between assessing Javascript as a language and discipline vs using JS as a tool to solve CS types and algorithm challenges.

Those types can certainly be a part of the assessment process, but cannot and should not constitute the sole dimension in which a JS candidate is evaluated.

Let me be clear though, Google and any other companies are in their right to assess and evaluate however they see fit for their engineering team, but those should be correctly labeled as "The Google Interview" or "The XYZ company interview".

If I'm someone looking at joining those companies, I should definitely study and get prepared accordingly and probably buy a copy of Cracking the Coding interview by Gayle McDowell

If you are an Avengers fan, then let's put it like this: Algorithms and CS are just one of the Infinity Stones. Powerful as a standalone but you will need all six to embrace their true power.

If you want to read more about why I feel so strongly about the JS interview process, you can take a quick read at my article on the subject here. 28 Relevant Javascript Interview Questions - Part 1

Cheers

Thank you for pointing this out.

I did not have any bad intentions with adding that title "Cracking the javascript coding interview.", it's just I was not able to think for the right title at that given time.

I just updated the title with what you have mentioned as I also think it is better than the previous one.

Hey Prashant thanks for updating the title but I never felt like you had any wrong intention here. The industry at large is subtly saying to the beginners audience that the CS interview is the Javascript interview, but that trend is hopefully changing slowly.
Thanks again and once again the list of resources you have shared are going to be handy.
Cheers

Andrey Sinaf

Thanks. Good knowledge library!

Guilherme Gonzaga

I just wanna say thank you for writing such an amazing post. I'll be constantly visiting your amazing website to study. Positive vibes from Brazil :)