SAP Labs interview experience Real time questions & tips from candidates to crack your interview

Software Developer

SAP Labs
upvote
share-icon
6 rounds | 12 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6 months
Topics: Data Structures, Algorithms, System Design, Aptitude, OOPS
Tip
Tip

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.

Application process
Where: Other
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

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.

Interview rounds

01
Round
Easy
Online Coding Interview
Duration90 minutes
Interview date10 Feb 2015
Coding problem1

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.

1. Reverse the String

Easy
15m average time
85% success
0/40
Asked in companies
IBMFacebookAcko

You are given a string 'STR'. The string contains [a-z] [A-Z] [0-9] [special characters]. You have to find the reverse of the string.

For example:

 If the given string is: STR = "abcde". You have to print the string "edcba".
follow up:
Try to solve the problem in O(1) space complexity. 
Problem approach

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)

Try solving now
02
Round
Medium
Face to Face
Duration60 minutes
Interview date14 Feb 2015
Coding problem6

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.

1. BFS in Graph

Easy
10m average time
90% success
0/40
Asked in companies
Morgan StanleySamsung R&D InstituteRubrik, Inc.

Given an adjacency list representation of a directed graph with ‘n’ vertices and ‘m’ edges. Your task is to return a list consisting of Breadth-First Traversal (BFS) starting from vertex 0.


In this traversal, one can move from vertex 'u' to vertex 'v' only if there is an edge from 'u' to 'v'. The BFS traversal should include all nodes directly or indirectly connected to vertex 0.


Note:
The traversal should proceed from left to right according to the input adjacency list.


Example:
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

example

Problem approach

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.

Try solving now

2. Find prime numbers

Easy
15m average time
80% success
0/40
Asked in companies
HSBCSalesforceDeutsche Bank

You are given a positive integer ‘N’. Your task is to print all prime numbers less than or equal to N.

Note: A prime number is a natural number that is divisible only by 1 and itself. Example - 2, 3, 17, etc.

You can assume that the value of N will always be greater than 1. So, the answer will always exist.

Problem approach

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

Try solving now

3. DBMS Question

What is BCNF ?

Problem approach

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.

4. OOPS Question

Difference between C and C++

Problem approach

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.

5. Puzzle

3 cuts to cut round cake into 8 equal pieces

Problem approach

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).

6. Puzzle

Calculate 45 minutes using 2 candles

Problem approach

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.

03
Round
Easy
Face to Face
Duration60 minutes
Interview date14 Feb 2015
Coding problem3

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.

1. Right View

Moderate
35m average time
65% success
0/80
Asked in companies
AdobeSAP LabsRazorpay

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.

Problem approach

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 ]

Try solving now

2. Puzzle

3 bulbs and 3 switches

Problem approach

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

3. OOPS Question

Explain the keywords : abstract, static , final.

Problem approach

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.

04
Round
Easy
Face to Face
Duration45 minutes
Interview date14 Feb 2015
Coding problem1

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.

1. Puzzle

2 Eggs 100 floors

Problem approach

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.

05
Round
Easy
Face to Face
Duration45 minutes
Interview date14 Feb 2015
Coding problem1

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.

1. DBMS Question

Design an ER diagram for Online Shopping portal.

Problem approach

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.

06
Round
Easy
HR Round
Duration30 minutes
Interview date14 Feb 2015
Coding problem0

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

Skill covered: Programming

What is recursion?

Choose another skill to practice
Similar interview experiences
company logo
Software Developer
4 rounds | 6 problems
Interviewed by SAP Labs
1053 views
0 comments
0 upvotes
company logo
Software Developer
3 rounds | 8 problems
Interviewed by SAP Labs
1103 views
0 comments
0 upvotes
company logo
Software Developer
4 rounds | 11 problems
Interviewed by SAP Labs
829 views
0 comments
0 upvotes
company logo
Software Developer
5 rounds | 6 problems
Interviewed by SAP Labs
778 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Software Developer
5 rounds | 14 problems
Interviewed by Microsoft
3931 views
1 comments
0 upvotes
company logo
Software Developer
3 rounds | 3 problems
Interviewed by Amazon
1133 views
0 comments
0 upvotes
company logo
Software Developer
4 rounds | 5 problems
Interviewed by Intuit
869 views
0 comments
0 upvotes