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.
The test was of moderate level, the coding question was easy if all the boundary questions were properly considered.



If there is no prime factor of a given integer, then print -1.
The direct approach is to traverse all elements of the array one by one. Initialise two variables max and second_max. For every element, check whether it is prime or not. If it is prime, update max and second_max accordingly. At the end, return the value stored in second_max variable.
The efficient approach would be to generate all primes upto maximum element of the array using sieve of Eratosthenes and store them in a hash. Now traverse the array and find the second maximum element which is prime using the hash table.
Time Complexity : O(n*log(log(n))



Hashing can be used to solve this problem. Build a hash table of all positive elements in the given array. Now, traverse the hash table for all positive integers starting from 1. As soon as a number is found that is not present in the hash table, return that number.
Time Complexity : O(N) on average
Auxiliary Space : O(N)
This problem can also be solved in O(1) space by using the given array as hash table. Use the array elements as index. To mark presence of an element x, Change the value at the index x to negative.
Steps:
1) Segregate positive numbers from others i.e., move all non-positive numbers to left side.
2) Now, consider only the part of array which contains all positive elements. Traverse the array containing all positive numbers.
For element x, mark its presence by changing the sign of value at index x to negative.
3)Now,Traverse the array again and print the first index which has positive value.
The interviewer was friendly and he was interested in the implementation first and then the code.
Tips: Be thorough with various implementations and why they are in practice. Try to know the logic behind each implementation.



A two-pointer approach can be used for this question. Maintain two indexes. Initialize the first index left as 0 and second index right as n-1, where n is size of the array .
While left < right , do the following :
a) Keep incrementing index left while arr[left] =0
b) Keep decrementing index right while arr[right]=1
c) If left < right then exchange arr[left] and arr[right]
What is Polymorphism?
Polymorphism is of two types :
1. Compile Time Polymorphism :
Invokes the overloaded functions by matching the number and type of arguments. The information is present during compile-time. This means the C++ compiler will select the right function at compile time. It is achieved through function overloading and operator overloading.
2. Run Time Polymorphism :
This happens when an object’s method is called during runtime rather than during compile time. Runtime polymorphism is achieved through function overriding. The function to be called is established during runtime.
What is operator overloading?
To overload an operator, we use a special operator function. We define the function inside the class or structure whose objects/variables we want the overloaded operator to work with.
Program overloading << operator :
#include
#include
class Time
{
int hr, min, sec;
public:
// default constructor
Time()
{
hr=0, min=0; sec=0;
}
// overloaded constructor
Time(int h, int m, int s)
{
hr=h, min=m; sec=s;
}
// overloading '<<' operator
friend ostream& operator << (ostream &out, Time &tm);
};
// define the overloaded function
ostream& operator << (ostream &out, Time &tm)
{
out << "Time is: " << tm.hr << " hour : " << tm.min << " min : " << tm.sec << " sec";
return out;
}
int main()
{
Time tm(3,15,45);
cout << tm;
return 0;
}
Differentiate between method overloading and method overriding
1) Method overloading is used to increase the readability of the program. Method overriding is used to provide the specific implementation of the method that is already provided by its super class.
2)Method overloading is performed within class. Method overriding occurs in two classes that have IS-A (inheritance) relationship.
3) In case of method overloading, parameter must be different. In case of method overriding, parameter must be same.
4) Method overloading is the example of compile time polymorphism. Method overriding is the example of run time polymorphism.
The interviewer was looking for a person interested in problem solving. He was looking forward for loud thinking.
Tips: If you don't know any answer, don't lose your cool. It is never necessary to answer all the questions in an interview. Be confident and think loud, so that if you are going the wrong way, the interviewer can assist you.
If a person travels from point A to point B at 20 km/h and returns at 30 km/h, calculate the average speed without using pen and paper.
Average Speed = Total Distance/ Total Time
Distance = Speed x Time
Let’s say the Distance between A and B is x
Time(A-B) = x/20 kmph = x/20 hr
Time(B-A) = x/30 kmph = x/30 hr
Total Time = (50/600)x hr
Total Distance = 2x
Average Speed = (2x)/[(50/600)(x)] =1200/50 kmph = 24 kmph
There are 20 red balls and 16 blue balls in a bag. Any 2 balls are removed at each step and are replaced with a new ball on the basis of the following conditions:
If they are of the same color, then they are replaced by a red ball.
If they are of different colors, then they are replaced with a blue ball.
Find the last ball to remain after the entire process.
Blue balls can only be reduced by two and that too if the 1st condition is satisfied, i.e., if you choose both blue balls, then they are replaced by a single red ball. In no other ways you can reduce blue balls. Red balls can be reduced by one on the basis of 2nd condition if you choose both different balls and on the basis of 1st condition if you choose both red balls.
Now, because there are an even number of blue balls and blue balls can only be reduced by two, you will end up with either 0 or 2 or 4...(even number) blue balls in the bag at any point during the replacement process. There will never be a situation in which the bag contains an odd number of blue balls. As a result, the last ball in the bag will be a red ball in any combination of replacements.
You are provided with 8 identical balls and a measuring instrument. 7 of the eight balls are equal in weight and one of the eight given balls is defective and weighs heavier. The task is to find the defective ball in exactly two measurements.
This was the last round and just for formality. The interviewers were looking for a person who would fit in their working culture.
Tips: Be confident and always have a smile on your face. If you are selected for the HR interview, then there is a 90% chance that you would be selected.
Q1. Do you have any question for us?
Q2. Questions based on my resume
Q3. What do i know about Times Internet and the work that happens in TIL
Q4. Why was i opting for a job as software developer though i was from Civil Engineering background
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?