Tip 1: Practice writing code by thinking through the solutions. Don't just memorize the solutions or practice verbally.
Tip 2: Focus on core JavaScript concepts before jumping into learning a framework directly.
Tip 1: Make a single-page resume.
Tip 2: Add only the skills you feel confident about.
It was an online round on the Codility platform with two problems to be attempted in 90 minutes. The problems were based on data structures—one on trees and one on graphs—and another on UI concepts.



Given a complete binary tree, you are supposed to return the number of nodes in the given tree.
Step 1: The approach is to first traverse the tree. To see the maximum value in the given path, the pre-order traversal is used to traverse the given binary tree.
Step 2: While traversing the tree, keep track of the maximum value of the node that we have seen so far. If the current node is greater or equal to the max value, then increment the count of the visible node and update the max value with the current node value.
function solution(T) {
if (!T) {
return 0;
}
let leftSubTreeVisibleNodes = getVisibleNodes(T.l, T.x);
let rightSubTreeVisibleNodes = getVisibleNodes(T.r, T.x);
return leftSubTreeVisibleNodes + rightSubTreeVisibleNodes + 1;
}
function getVisibleNodes(tree, prevMax) {
if (!tree) {
return 0;
}
// pass max value up to current node to check for visibility
let leftCount = getVisibleNodes(tree.l, Math.max(prevMax, tree.x));
let rightCount = getVisibleNodes(tree.r, Math.max(prevMax, tree.x));
if (tree.x >= prevMax) {
return leftCount + rightCount + 1;
} else {
return leftCount + rightCount;
}
}
There is a list of elements in the UI with a comment count. Fetch the comments from an API and render them in an optimised manner.
This round was majorly based on JS Core concepts and some DS problems.
What is Prototypal Inheritance?
Explain Hoisting, Event Loop?
What is the difference between Shallow and Deep Copy? (Learn)
Tip 1: Focus on JS concepts and o/p questions.
Tip 2: Cross-check your solution thoroughly before discussing it with the interviewer.
Tip 3: Study theory as well as keep examples ready.


Given a singly linked list of 'N' nodes. The objective is to determine the middle node of a singly linked list. However, if the list has an even number of nodes, we return the second middle node.
Step 1: Traverse the linked list using two-pointers.
Step 2: Move one pointer by one and the other pointers by two. When the fast pointer reaches the end, the slow pointer will reach the middle of the linked list.



Given two numbers represented by linked lists. Your task is to find the sum list and return the head of the sum list.
The sum list is a linked list representation of the addition of two numbers.
Step 1: Calculate the sizes of the given two linked lists.
Step 2: If sizes are the same, then calculate the sum using recursion. Hold all nodes in the recursion call stack till the rightmost node, calculate the sum of the rightmost nodes and forward carry to the left side.
Step 3: If the size is not the same, then follow the below steps:
a) Calculate the difference in sizes of two linked lists. Let the difference be diff
b) Move different nodes ahead in the bigger linked list. Now use step 2 to calculate the sum of the smaller list and right sub-list (of the same size) of a larger list. Also, store the carry of this sum.
c) Calculate the sum of the carry (calculated in the previous step) with the remaining left sub-list of a larger list. Nodes of this sum are added at the beginning of the sum list obtained in the previous step.
This round was based on JS Concepts like Promises, and Is JS compiled or interpreted. Some TypeScript concepts like type vs inheritance were also asked. Designing classes was also discussed.
Show the usage of the interface in creating classes and what is the advantage of the same. Coding problem on the same as well.
We can use an interface for multiple similar classes having similar functionality. It helps us to define a contract and also we can assign instances of any class to that interface type item at runtime.
Convert a callback approach to a promise-based approach.
Tip 1: Study the concept of promises and its advantage over callbacks.
Tip 2: Study promise APIs like all, any etc.
This round was based on DS and JS.


You have been given a Binary Tree of integers.
Your task is to print the Right view of it.
The right view of a Binary Tree is a set of nodes visible when the tree is viewed from the Right side and the nodes are printed from top to bottom order.
Step 1: Level order traversal is used.
Step 2: Print the rightmost node of every level. So, do a level order traversal on the tree and print the last node at every level.
Write a custom deep copy function in JS.
function deepCopy(obj) {
const copyObj = {}
for (const key in obj) {
if (typeof obj[key] === 'object') {
copyObj[key] = deepCopy(obj[key]);
} else {
copyObj[key] = obj[key];
}
}
return copyObj
}
It was a discussion with the project manager
Tell me about yourself
Why are you looking for a change?
What are your strengths?
Where do you see yourself in the upcoming 5 years?
Prepare for some behavioural questions as well.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?