Tip 1 : Go through the basic and advanced concepts of JavaScript
Tip 2 : Do the string and Array question from internet
Tip 3 : Do database design questions and API questions as well
Tip 1 : Have 1-page resume
Tip 2 : Mention all your skills in your resume
The total time was 1 hour and the timing was between 2-3 pm afternoon. The interviewer joined the meeting on time. It started with a basic self-introduction and then we started with interview questions.
Step 1 : Start traversing the given string.
a) If an alphabet comes to increment its
occurrence count into a hash_table.
b) If an integer comes then store it
separately by summing it up every time.
Step 2 : Using hash_table append all the
characters first into a string and
then at the end, append the integers
sum.
Step 3 : Return the resultant string.
1. The array follows 0-based indexing, so you need to return 0-based indices.
2. If 'x' is not present in the array, return {-1 -1}.
3. If 'x' is only present once in the array, the first and last position of its occurrence will be the same.
Input: arr = [1, 2, 4, 4, 5], x = 4
Output: 2 3
Explanation: The given array’s 0-based indexing is as follows:
1 2 4 4 5
↓ ↓ ↓ ↓ ↓
0 1 2 3 4
So, the first occurrence of 4 is at index 2, and the last occurrence of 4 is at index 3.
Brute force approach, first I used this approach:
1. Run a for loop and for i = 0 to n-1
2. Take first = -1 and last = -1
3. When we find the element the first time then we update first = i
4. We always update last=i whenever we find the element.
5. We print first and last.
The interviewer asked me to optimize the solution
Efficient approach:
We can solve this with the help of a binary search.
It was 1 hour interview. It was based on problem-solving with javascript. In this interview, I was asked to solve the 3 questions in a single run(I only had 1 chance to execute each problem statement).
The merging process must start from the root nodes of both trees.
‘ROOT1’ = [1, 2, -1, -1, 3, -1, -1] ‘ROOT2’ = [3, -1, -1].
The final tree would look like : [3, 2, -1, -1, 3, -1, -1], and the output will be printed in a pre-order way: 4 2 3.
I used the simple recursive merge technique to solve the problem. The interviewer didn't ask me to optimize further.
If the given input string is "Welcome to Coding Ninjas", then you should return "Ninjas Coding to Welcome" as the reversed string has only a single space between two words and there is no leading or trailing space.
I used javascript inbuilt functions to solve the problem. Such as split, reverse, and join
This round was based on a system design problem. This interview was also for an hour.
DB schema of a ticket booking system along with APIs endpoints and handling concurrency. Further asked to normalize the database.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is the output of print(type("Python"))?