Cracking a coding interview ?

Cracking a coding interview is not as simple as it looks.

Here you are not only judged on the basis of your coding ability but also your analytical skills.

Many a times it happens that interviewer may ask very simple questions and you are in different realm making that simple problem into your worst nightmare. Even if the solution to that problem is very easy.

So how to solve that blockage ?

Only thing which is required to done is practise,practise and more practise.

What are missing is that connect/trick which is required to solve the problem.

So Data structure is something that will improve our chance to crack those interview and something to understand various concepts.

How to Start with Data Structure ?

I am trying to teach all the newbies, How its done ? If you are one of those

Welcome guys this is for you . Now we will start with those fundamental which should be strong but Alas!!!!! we lack them.


I assume you have a brief idea about what are string , integers ,number and array and all those basic stuff that you have learnt in your graduation degree.

Lets get started , First and foremost problem which we are going to solve an problem of Reversing a string.

Reverse String:

This is as basic as it could be .

Problem: In this example you simply need to reverse a string . By using simplest way you can think of.

Example : reverse(‘abcd’)//should return ‘dcba’

Now wait. give yourself some time to solve it.

Just take a pen and a paper and start thinking of the possible solution that you think you can achieve. A doing it on a paper or white board will give you feel of an actual interview

If in case you still feel like that I am done, or that you want to see the solution, than welcome guys.

The Possible Solutions of reversing any given string could be as follows

Solution 1:

function reverse(str){

return str.split(‘’).reverse().join(‘’);


According to me this could be the shortest solution you can do to achieve string reversal.

But most of the interviewer wont like it that you are using inbuilt function.

So buckle up guys you can solve it in a much better way.

Yes so the another possible solution which I was able to find out was as follow

Solution 2

We can use for of loop . In this we simply loop through out given string and add the character in reversed order

for (character of str) {

reversed = character + reversed


return reversed

Solution 3

Although there could be many other. Might be even you are aware about them.

Best solution which I was able to find out was this:

function reverse(str) {

return str.split(‘’).reduce((rev, char) => {return char + rev})


Here I have used reduce function which will add value from the array .

So yes these are some of the possible solution which we can achieve to solve the problem.

I am covering Reverse string in this story and will be covering other topic in subsequent stories. For example

String Reversal




The Classic FizzBuzz

Array Chunking

and Many more

Who’s links will soon be shared.


Mindroast 🇮🇳 , Techie 🖥️, Wanderer 🤔, Traveller ✈️ Subscribe to Newsletter: