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.
Online test had 6 parts-psychometric test, aptitude, logical, English, computer skills and 2 coding questions. Time given to us was 90 minutes. Paper was quite lengthy and of average difficulty level. I was able to complete all the sections, but only one coding question.



If the given string is: STR = "abcde". You have to print the string "edcba".
Try to solve the problem in O(1) space complexity.
This can be done by iterative swapping using two pointers. The first pointer points to the beginning of the string, whereas the second pointer points to the end. Both pointers keep swapping their elements and go towards each other. Essentially, the algorithm simulates the rotation of a string with respect to its midpoint.
Time Complexity : O(n)
Firstly the interviewer asked me to introduce myself after he introduced himself. Since i went there as experienced guy he asked me about my workings in the current company. After that,he asked some programming questions, tested my concepts of DBMS and OOPS, and some puzzles.



The traversal should proceed from left to right according to the input adjacency list.
Adjacency list: { {1,2,3},{4}, {5}, {},{},{}}
The interpretation of this adjacency list is as follows:
Vertex 0 has directed edges towards vertices 1, 2, and 3.
Vertex 1 has a directed edge towards vertex 4.
Vertex 2 has a directed edge towards vertex 5.
Vertices 3, 4, and 5 have no outgoing edges.
We can also see this in the diagram below.
BFS traversal: 0 1 2 3 4 5

BFS is a traversing algorithm we start traversing from a selected node (starting node) and traverse the graph layer wise thus exploring the neighbor nodes (nodes which are directly connected to source node). And then move towards the next-level neighbor nodes.
Pseudocode :
BFS (G, s)
Q.push( s ) //Inserting s in queue Q until all its neighbor vertices are marked.
mark s as visited.
while ( Q is not empty)
//Removing that vertex from queue, whose neighbor will be visited now
u = Q.pop( )
//processing all the neighbors of u
for all neighbors v of u in Graph G
if v is not visited
Q.push( v ) //Stores v in Q to further visit its neighbor
mark w as visited.



The naïve approach for this question is to run a loop from the start to the end number. And for each number, check if it is prime or not. If the number is prime, we print it otherwise skip it.
One optimization to this approach would be to skip all even numbers (except 2 if present in interval) since even numbers are not prime.
Function to check if a number is prime or not :
isPrime(n):
if (n <= 1) return false
for (i=2; i if (n%i == 0)
return false
}
return true
What is BCNF ?
Boyce-Codd Normal Form or BCNF is an extension to the third normal form. For a table to satisfy the Boyce-Codd Normal Form, it should satisfy the following two conditions:
1. It should be in the Third Normal Form.
2. And, for any dependency A → B, A should be a super key i.e. for a dependency A → B, A cannot be a non-prime attribute, if B is a prime attribute.
Difference between C and C++
1. The C programming language is a procedural language type while C++ is an object-oriented programming language type.
2. C programming follows a top to down programming approach that focuses on the steps rather than the data. C++ follows a bottom-to-top approach that focuses on data rather than the overall procedure.
3. Since C is a structured programming language the program is divided into separate blocks known as functions. Since C++ is an object-oriented programming language, the code is divided into Objects and Classes.
3 cuts to cut round cake into 8 equal pieces
Cut #1 – Down the center of the cake (vertically) leaving two equal halves.
Cut #2 – Across the center of the cake (horizontally) leaving four equal slices.
Cut #3 – Through the middle edge of the cake slicing all four of the pieces in equal halves, leaving eight equal slices (four equal tops and four equal bottoms).
Calculate 45 minutes using 2 candles
1.Light the first candle from both the sides and 2nd candle from one side.
2.1st candle will finish in 30 min. while 2nd candle will be burnt half way.
3.Now light 2nd candle from both the sides. It will finish in next 15 min.
So we have calculated 45 minutes in all.
Again 2nd round started with an introduction from both sides. Then he started asking questions from resume itself. Working in the current company and all the projects that i have done. Few simple puzzles, OOPs concepts (with proper explanation and coding) and some database related questions(questions were easy you just need to brush up the basics). Some keywords related questions from C,C++,Java(usual questions like static ,final, abstract etc.). That was the 2nd round. Then I was called for the 3rd Round. Before 3rd round they also served tasty lunch.


BFS can be used to solve this question.
Steps :
1. Traverse the whole tree in level order fashion using BFS along with storing the last processed node (curr).
2. Keep a tag at the end of each level to know that a particular level has ended.
3. Whenever a level ends store the last processed node value to the resultant list.
Time Complexity : O(n) [ Since, each node is traversed exactly once ]
Space Complexity : O(w) [ 'w' is the maximum width of the tree ]
3 bulbs and 3 switches
Let the bulbs be B1, B2, and B3. Turn on switch B1 for 10 minutes. Turn it off and turn on switch B2. Open the door 1. and the bulb which is on is of switch B2. Now touch the other light bulbs :
2. the bulb which is hot is B1
3. the bulb which is cold is B3
Explain the keywords : abstract, static , final.
Static : The static keyword in Java is mainly used for memory management. We can apply static keyword with variables, methods, blocks and nested classes. The static keyword belongs to the class than an instance of the class. A static member is a member of a class that isn’t associated with an instance of a class. Instead, the member belongs to the class itself.
Abstract : The abstract keyword is used to achieve abstraction in Java. It is a non-access modifier which is used to create abstract class and method. The role of an abstract class is to contain abstract methods. However, it may also contain non-abstract methods. The method which is declared with abstract keyword and doesn't have any implementation is known as an abstract method.
Final : Java final keyword is a non-access specifier that is used to restrict a class, variable, and method. If we initialize a variable with the final keyword, then we cannot modify its value. If we declare a method as final, then it cannot be overridden by any subclasses. And, if we declare a class as final, we restrict the other classes to inherit or extend it.
After that he asked me what I knew about SAP and there products(Please do read all about SAP and there products-not all but at least some famous products like ERP). Then he asked me one puzzle.
2 Eggs 100 floors
When we drop an egg off a floor, we explore that floor. If the egg breaks, then we’re forced to explore the lower floors with 1 egg and t−1 tries. But if the egg survives, then we can move on to the upper floors with 2 eggs and t−1 tries. So the total distance that we can explore with 2 eggs and t tries is:
d2(t)=1+d1(t−1)+d2(t−1)
For one egg problem : d1(t) = t , t>=0
d2(t)=1+(t−1)+d2(t−1)
d2(t)=t+d2(t−1)
We can expand this recurrence relation:
d2(t)=t+(t−1)+...+1+d2(0)
When we’re out of tries, we can’t explore any further, no matter how many eggs we have left:
dn(0)=0
This gives the closed-form solution:
d2(t)=t+(t−1)+...+1
d2(t)=(t*(t+1))/2 for t≥0
In particular:
d2(13)=91
d2(14)=105
So, given two eggs, we’re guaranteed to find the right floor of a 100-story building within fourteen tries.
The round started with our Introduction to each other. After that interviewer asked me whether I do online shopping or not. I said yes then he asked me to design the online shopping portal using ER-Diagram . Then he asked me to create all the tables and populate it with data. Later on he asked me to normalize it. After all of this he asked me some simple puzzles and current salary and notice period. That was the 4th round.
After that I was asked to attend the final round and before 5th round they served snacks and tea to all of us.
Design an ER diagram for Online Shopping portal.
Tip 1 : Make all necessary assumptions required to create the relations and tables
Tip 2 : Identify all the main entities of the management system and their relationships with each other.
Tip 3 : For each entity, define all the necessary attributes.
5th round was kind of mixture of managerial and HR. Two people came to take the interview. They asked me questions related to projects that I have done and working of my current company. I was asked to tell them about my current company for at least 2 minutes. Then he asked me one simple arithmetic puzzle- Using 3 only for six times or five times I have to generate 28 or 31 using world’s any operator. That was the 5th round.
Over all it was a great experience. I loved being interviewed at SAP Labs. People at SAP are highly cooperative and helpful.

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