Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.
Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.
This was an online coding round where we had 2 questions to solve under 70 minutes.



Anagrams are defined as words or names that can be formed by rearranging the letters of another word. Such as "spar" can be formed by rearranging letters of "rasp". Hence, "spar" and "rasp" are anagrams.
'triangle' and 'integral'
'listen' and 'silent'
Since it is a binary problem, there is no partial marking. Marks will only be awarded if you get all the test cases correct.
Approach :
1) Sort both strings, so that all the same characters come together.
2) Then loop through both strings together and check each element in both strings one by one.
3) If at any position, the characters are found to be different or if the lengths of the two strings are different, they cannot be anagrams.
4) Otherwise, they will be anagrams.
TC : O(N * log(N) + (M * log(M))), where N and M are the lengths of the two input strings.
SC : O(1)



If the given ‘HEIGHT’ array is [10,20,30,10], the answer 20 as the frog can jump from 1st stair to 2nd stair (|20-10| = 10 energy lost) and then a jump from 2nd stair to last stair (|10-20| = 10 energy lost). So, the total energy lost is 20.
Approach :
1) Declare an array ‘DP’ of size N+1.
2) Set DP[N] as 0.
3) Set DP[N-1] as abs(HEIGHTS[N-1] - HEIGHTS[N-2]).
4) For i in range N-2 to 1:
4.1) Set ONE_JUMP as DP[i+1] + abs(HEIGHTS[i-1]-HEIGHTS[i]).
4.2) Set TWO_JUMP as DP[i+2] + abs(HEIGHTS[i-1]-HEIGHTS[i+1]).
4.3) Set DP[i] as the minimum of ONE_JUMP and TWO_JUMP.
5) Set ‘ANS’ as DP[1].
6) Return ANS.
TC : O(N), where N = number of stairs
SC : O(N)
This round had 2 coding questions where I was expected to first explain my approach with proper complexity analysis and then write the pseudo code for both the solutions.



• The left subtree of a node contains only nodes with data less than the node’s data.
• The right subtree of a node contains only nodes with data greater than the node’s data.
• Both the left and right subtrees must also be binary search trees.
It is guaranteed that a BST can be always constructed from the given preorder traversal. Hence, the answer will always exist.
From PREORDER = [20, 10, 5, 15, 13, 35, 30, 42] , the following BST can be constructed:

Approach (Using Recursion) :
1) Defining the preorder(node, ans) :
i) If the node is an empty node, we will return from the function.
ii) Insert node value into the ans array.
ii) Now we will traverse to the left subtree.
iv) Create a recursive call preorder(left child of the node, ans).
v) Now we will traverse to the right subtree.
vi) Create a recursive call preorder(right child of the node, ans).
2) We will define an array ans to store the preorder traversal of the given tree.
3) We will call preorder(root, ans).
4) Return the array ans.
//Pseudo Code
vectorans;
void preorder(TreeNode*root)
{
if(root)
{
ans.push_back(root->val);
preorder(root->left);
preorder(root->right);
}
}
TC : O(N), where N = number of nodes in the tree.
SC : O(N)



If we are given an array ARR=[1,2,3] then the power set P(ARR) of the set ARR is: [ [], [1], [2], [1,2], [3], [1,3], [2,3], [1,2,3] ]
For every subset 'X' present in power set P(ARR) of set ARR, X must be sorted i.e. in the example above:
P1(ARR) = [ [], [1], [2], [1,2], [3], [1,3], [2,3], [1,2,3] ]
P2(ARR) = [ [], [1], [1,2,3], [2], [1,2], [3], [1,3], [2,3] ]
P3(ARR) = [ [], [1], [2], [1,2], [3], [1,3], [2,3], [2,3,1] ]
P1(ARR) and P2(ARR) will be considered correct power sets but P3(ARR) will not be considered correct because there the last subset [2, 3, 1] is not sorted.
Approach (Using Bit Masking) :
1) We have two possibilities either selecting a number in subset or not.
2) A bit can be either 0 or 1, thus we can use this to denote whether the corresponding element belongs to the current subset or not. So each bit pattern will represent a subset. So we will get all the subsets.
3) Let’s say we have a given array ARR.
4) Let ANS = [ [] ] is our answer.
5) Iterate 0<= I <=2^N and do:
5.1) CURR = []
5.2) Iterate over ARR[i] for each 0 <= J < N and do:
If the Jth bit is set in I then include the Jth element to CURR.
5.3) Append CURR to ANS.
//Pseudo Code :
vector>PowerSet(vectorarr)
{
int n=arr.size();
int total=(1<>ans;
for(int i=0; itmp;
for(int j=0; j {
if(i&(1< tmp.push_back(arr[j]);
}
ans.push_back(tmp);
}
return ans;
}
TC : O(N*(2^N)), where N = length of the string.
SC : O(N*(2^N))
In this round I was first asked a simple coding question related to Linked List and then the interviewer switched to questions related to Python as I told him I had been coding in Python for the last 2 years and so I was tested on my skills in Python and OOPS.



The Linked Lists, where a1, a2, c1, c2, c3 is the first linked list and b1, b2, b3, c1, c2, c3 is the second linked list, merging at node c1.

Approach :
1) Calculate the length of both the lists, say len1 and len2
2) Get the absolute difference of the lengths, diff = |len1 – len2|
3) Now traverse the long list from the first node till ‘diff’ nodes so that from there onwards both the lists have equal
number of nodes
4) Then traverse both the lists in parallel and check whether a common node is reached (Note that getting a common
node is done by comparing the address of the nodes, not the data)
4.1) If yes, return that node’s data
4.2) If no, return -1
TC : O(N) , where N = max length of the linked list
SC : O(1)
What are global, protected and private attributes in Python?
1) Global variables are public variables that are defined in the global scope. To use the variable in the global scope inside a function, we use the global keyword.
2) Protected attributes are attributes defined with an underscore prefixed to their identifier eg. _sara. They can still be accessed and modified from outside the class they are defined in but a responsible developer should refrain from doing so.
3) Private attributes are attributes with double underscore prefixed to their identifier eg. __ansh. They cannot be accessed or modified from the outside directly and will result in an AttributeError if such an attempt is made.
What is the use of self in Python?
Self is used to represent the instance of the class. With this keyword, you can access the attributes and methods of the class in python. It binds the attributes with the given arguments. self is used in different places and often thought to be a keyword. But unlike in C++, self is not a keyword in Python.
What is the difference between Python Arrays and lists?
1) Arrays in python can only contain elements of same data types i.e., data type of array should be homogeneous. It is a thin wrapper around C language arrays and consumes far less memory than lists.
2) Lists in python can contain elements of different data types i.e., data type of lists can be heterogeneous. It has the disadvantage of consuming large memory.
What is pickling and unpickling?
Python library offers a feature - serialization out of the box. Serializing an object refers to transforming it into a format that can be stored, so as to be able to deserialize it, later on, to obtain the original object. Here, the pickle module comes into play.
Pickling:
Pickling is the name of the serialization process in Python. Any object in Python can be serialized into a byte stream and dumped as a file in the memory. The process of pickling is compact but pickle objects can be compressed further. Moreover, pickle keeps track of the objects it has serialized and the serialization is portable across versions.
The function used for the above process is pickle.dump().
Unpickling:
Unpickling is the complete inverse of pickling. It deserializes the byte stream to recreate the objects stored in the file and loads the object to memory.
The function used for the above process is pickle.load()
What is init method in python?
The init method works similarly to the constructors in Java. The method is run as soon as an object is instantiated. It is useful for initializing any attributes or default behaviour of the object at the time of instantiation.
How does inheritance work in python?
Inheritance gives the power to a class to access all attributes and methods of another class. It aids in code reusability and helps the developer to maintain applications without redundant code. The class inheriting from another class is a child class or also called a derived class. The class from which a child class derives the members are called parent class or superclass.
Python supports different kinds of inheritance, they are:
1) Single Inheritance: Child class derives members of one parent class.
2) Multi-level Inheritance: The members of the parent class, A, are inherited by child class which is then inherited by another child class, B. The features of the base class and the derived class are further inherited into the new derived class, C. Here, A is the grandfather class of class C.
3) Multiple Inheritance: This is achieved when one child class derives members from more than one parent class. All features of parent classes are inherited in the child class.
4) Hierarchical Inheritance: When a parent class is derived by more than one child class, it is called hierarchical inheritance.
This is a cultural fitment testing round. HR was very frank and asked standard questions. Then we discussed about my role.
Tell me something not there in your resume.
If you get this question, it's an opportunity to choose the most compelling information to share that is not obvious from
your resume.
Example :
Strength -> I believe that my greatest strength is the ability to solve problems quickly and efficiently, which makes me
unique from others.
Ability to handle Pressure -> I enjoy working under pressure because I believe it helps me grow and become more
efficient.
Tip : Emphasize why you were inspired to apply for the job. You can also explain that you are willing to invest a great
deal of energy if hired.
These are generally very open ended questions and are asked to test how quick wit a candidate is. So there is
nothing to worry about if you have a good command over your communication skills and you are able to propagate
your thoughts well to the interviewer.
Why should we hire you ?
Tip 1 : The cross questioning can go intense some time, think before you speak.
Tip 2 : Be open minded and answer whatever you are thinking, in these rounds I feel it is important to have opinion.
Tip 3 : Context of questions can be switched, pay attention to the details. It is okay to ask questions in these round,
like what are the projects currently the company is investing, which team you are mentoring. How all is the work
environment etc.
Tip 4 : Since everybody in the interview panel is from tech background, here too you can expect some technical
questions. No coding in most of the cases but some discussions over the design can surely happen.

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