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

SDE - Intern

SAP Labs
upvote
share-icon
3 rounds | 11 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 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: Campus
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 Test
Duration60 minutes
Interview date8 Jun 2015
Coding problem2

It was a 60 minute online coding round. 2 programming questions were asked in this round.

1. Minimum Number of Platforms

Moderate
30m average time
70% success
0/80
Asked in companies
MeeshoGrabAmazon

You have been given two arrays, 'AT' and 'DT', representing the arrival and departure times of all trains that reach a railway station.

Your task is to find the minimum number of platforms required for the railway station so that no train needs to wait.

Note :
1. Every train will depart on the same day and the departure time will always be greater than the arrival time. For example, A train with arrival time 2240 and departure time 1930 is not possible.

2. Time will be given in 24H format and colons will be omitted for convenience. For example, 9:05AM will be given as "905", or 9:10PM will be given as "2110".

3. Also, there will be no leading zeroes in the given times. For example, 12:10AM will be given as “10” and not as “0010”.
Problem approach

The idea is to use the sorted arrival and departure times of trains and count the total number of platforms needed at a time . Maintain a counter to count the total number of trains present at the station at any point. 
If the train is scheduled to arrive next, increase the counter by one and update the minimum platforms needed if the count is more than the minimum platforms needed so far.
If the train is scheduled to depart next, decrease the counter by 1.
Time Complexity : O(nlogn)

Try solving now

2. Uncommon Characters

Moderate
25m average time
65% success
0/80
Asked in company
SAP Labs

Given two strings S1 and S2 of lowercase alphabets, find the list of uncommon characters for the two strings.

A character is uncommon if it is present only in one of the strings i.e. it is either present in S1 or S2, but not in both.

Note :
1. Both the strings contain only lowercase alphabets and can contain duplicates.

2. Return the uncommon characters in lexicographically sorted order. 
Problem approach

Concept of hashing can be applied to solve this problem.
1. Create a hash table with a size of 26 for all lowercase characters.
2. Mark each character as '0' (indicating it is not present in both strings).
3. Mark the presence of each character in the 1st string as a '1' in the hash table, denoting the 1st string.
4. Next, traverse the 2nd string. For every character in string 2, check whether its presence in the hash table is '1' or not. If it is a 1, you should mark its presence as a -1 (indicating that the character is common to both strings), otherwise you should mark it as a 2 (indicating the 2nd string).
Time complexity : O(m+n) where m,n are lengths of the two strings

Try solving now
02
Round
Easy
Face to Face
Duration35 minutes
Interview date12 Jun 2015
Coding problem9

The first one was a technical interview lasting for about 35 minutes. 
Firstly, he asked me to introduce myself. I told about my academics, family, achievements, strengths and hobbies. He asked about my father's occupation and what and why have I got to learn from his work. I told my hobbies as playing logical games and solving logical questions as well as net-surfing. 
He asked which type of websites do I visit and why. He asked me the areas of interest. And I told C, C++ and java. And, I prefer C++ more. He asked some basic theoretical questions. He gave me two programs to implement. Then, he gave me two SQL queries and also asked some questions on OS concepts. Then, he came to my project and asked about all my three projects done thoroughly with architecture and coding. 
Later, he asked two puzzles and I answered them correctly.

1. Swap Number Without Temporary Variable

Easy
15m average time
85% success
0/40
Asked in companies
SAP LabsBNY MellonMakeMyTrip

Given two variables ‘X’ and ‘Y’. Your task is to swap the number without using a temporary variable or third variable.

Swap means the value of ‘X’ and ‘Y’ must be interchanged. Take an example ‘X’ is 10 and ‘Y’ is 20 so your function must return ‘X’ as a 20 and ‘Y’ as a 10.

Problem approach

In this variation of swapping two variables without using any temporary variable, concept of addition and subtraction can be used.
var1 = var1 + var2;
var2 = var1 - var2;
var1 = var1 - var2;
In the first variable we are storing the sum of both variable. 
Then, in next step we are we are extracting the value of 1st variable by subtracting the value of 2nd variable form the sum & storing it in 2nd variable.
At last, we are extracting the original value of the 2nd variable & storing it in the 1st variable.

Try solving now

2. OOPS Question

Insertion and deletion of elements from queue

Problem approach

1. Deletion: . An element can only be deleted when there is at least an element to delete i.e. rear > 0. Now, element at arr[front] can be deleted but all the remaining elements have to shifted to the left by one position in order for the dequeue operation to delete the second element from the left on another dequeue operation.
Dequeue()
{
if (front == rear) {
return
}
else {
for (i = 0; i < rear - 1; i++) {
queue[i] = queue[i + 1]
}

rear--
}
}

2. Insertion : Adding an element will be performed after checking whether the queue is full or not. If rear < n which indicates that the array is not full then store the element at arr[rear] and increment rear by 1 but if rear == n then it is said to be an Overflow condition as the array is full.
Enqueue(data)
{
if (capacity == rear) {
return
}
else {
queue[rear] = data
rear++
}
}

3. OS Question

What is a deadlock and what are the solutions to it?

Problem approach

A Deadlock is a situation where each of the computer process waits for a resource which is being assigned to some another process. In this situation, none of the process gets executed since the resource it needs, is held by some other process which is also waiting for some other resource to be released.
Methods that are used in order to handle the problem of deadlocks are as follows:
1. Ignoring the Deadlock
According to this method, it is assumed that deadlock would never occur. This approach is used by many operating systems where they assume that deadlock will never occur which means operating systems simply ignores the deadlock.
2.Deadlock Prevention
The main aim of the deadlock prevention method is to violate any one condition among the four; because if any of one condition is violated then the problem of deadlock will never occur. As the idea behind this method is simple but the difficulty can occur during the physical implementation of this method in the system.
3.Avoiding the Deadlock
This method is used by the operating system in order to check whether the system is in a safe state or in an unsafe state. This method checks every step performed by the operating system. Any process continues its execution until the system is in a safe state. Once the system enters into an unsafe state, the operating system has to take a step back.
4.Deadlock detection and recovery
With this method, the deadlock is detected first by using some algorithms of the resource-allocation graph. This graph is mainly used to represent the allocations of various resources to different processes. After the detection of deadlock, a number of methods can be used in order to recover from that deadlock

4. OS Question

What is process synchronization?

Problem approach

The goal of process synchronization is to coordinate the execution of processes in a way where no two processes can share the same data and resources. Multi-process systems often use this mechanism when multiple processes try to access the same data or resource simultaneously, especially when multiple processes are running simultaneously. This can lead to inconsistent shared data. Therefore, changes made by one process may not necessarily be reflected by other processes that access the same shared data. This type of data inconsistency can be avoided by synchronizing the processes.

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

6. OOPS Question

What is a friend function ?

Problem approach

A friend function is a function that is declared outside a class but is capable of accessing the private and protected members of the class. There could be situations in programming wherein we want two classes to share their members. These members may be data members, class functions or function templates. In such cases, we make the desired function, a friend to both these classes which will allow accessing private and protected data members of the class. 
Friend Function Syntax:
class className {
... .. ...
friend returnType functionName(arguments);
... .. ...
}
By using the keyword, the ‘friend’ compiler understands that the given function is a friend function.

7. OS Question

Advantages of multithreading

Problem approach

1. Enables programmers to do multiple things at one time.
2. Programmers can divide a long program into threads and execute them in parallel which eventually increases the speed of the program execution.
3. Improved performance and concurrency.
4. Simultaneous access to multiple applications .

8. OOPS Question

What is function overriding?

Problem approach

Function overriding is a feature that allows us to have a same function in child class which is already present in the parent class. A child class inherits the data members and member functions of parent class, but when you want to override a functionality in the child class then function overriding can be used.
To override a function , the child class must have the same signature (the data type and sequence of parameters).

9. Puzzles

1. Two candles and a match box is given, each burning for 1 hour, how to measure 30 minutes. 
2. Nine balls are given. All are equally weighed except one that was less weighed. How would we identify the less weighed in two chances?

03
Round
Easy
HR Round
Duration30 minutes
Interview date12 Jun 2015
Coding problem0

I introduced myself. Then, he asked about SAP. I told almost everything from its inception to its lasting. Then, he asked why do you want to be in SAP and Why Have you come for this profile. I told everything with reasons .Then, he again asked about a rough idea about my projects and told his profile. He asked me to write an essay of about 200 words of any favorite topic. Then, he asked any question if I wanted to ask him.

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

How do you remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
company logo
SDE - Intern
4 rounds | 11 problems
Interviewed by SAP Labs
1567 views
0 comments
0 upvotes
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by SAP Labs
2136 views
0 comments
0 upvotes
company logo
SDE - Intern
4 rounds | 4 problems
Interviewed by SAP Labs
825 views
0 comments
0 upvotes
company logo
SDE - Intern
4 rounds | 8 problems
Interviewed by SAP Labs
1900 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Amazon
15605 views
4 comments
0 upvotes
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by Microsoft
15499 views
1 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Amazon
10215 views
2 comments
0 upvotes