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

SDE - 1

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

Interview preparation journey

expand-icon
Preparation
Duration: 3 months
Topics: Data Structures ,sql, machine learning, OOPS, System Design, Algorithms, Dynamic Programming
Tip
Tip

Tip 1 : Practice at least 5 codes daily.
Tip 2 : Do at-least one machine Learning Project.

Application process
Where: Campus
Eligibility: 7 CGPA
Resume Tip
Resume tip

Tip 1 : Have at least three project.
Tip 2 : Put some achievements.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration60 minutes
Interview date7 Aug 2019
Coding problem2

1. Find all anagrams

Easy
15m average time
85% success
0/40
Asked in companies
American ExpressThought WorksWalmart

You have been given a string STR and a non-empty string PTR. Your task is to find all the starting indices of PTR’s anagram in STR.

An anagram of a string is another string which contains the same characters and is obtained by rearranging the characters.

For example: ‘SILENT’ and ‘LISTEN’ are anagrams of each other. ‘ABA’ and ‘ABB’ are not anagram because we can’t convert ‘ABA’ to ‘ABB’ by rearranging the characters of particular strings.

Note:

1. Both STR and PTR consist of English uppercase letters.
2. Length of string 'STR' will always be greater than or equal to the length of string ‘PTR’.
3. In case, there is no anagram substring, then return an empty sequence.
4. In case of more than one anagrams, return the indices in increasing order.
Problem approach

I need to do the implementation in O(n) as many test cases were failing for O(nlogn).

I used the extra space as i created the array of 256 characters but you can optimise it using HashMap where you can store character and count of character in HashMap. Idea is to put all characters of one String in HashMap and reducing them as we encounter while looping over other String.

Try solving now

2. Subset Sum

Easy
0/40
Asked in companies
AmazonGoldman SachsSAP Labs

You are given an array 'nums' of ‘n’ integers.


Return all subset sums of 'nums' in a non-decreasing order.


Note:
Here subset sum means sum of all elements of a subset of 'nums'. A subset of 'nums' is an array formed by removing some (possibly zero or all) elements of 'nums'.


For example
Input: 'nums' = [1,2]

Output: 0 1 2 3

Explanation:
Following are the subset sums:
0 (by considering empty subset)
1 
2
1+2 = 3
So, subset sum are [0,1,2,3].
Problem approach

Tip 1:As test cases will not pass with the brute force method , try to implement with DP

Try solving now
02
Round
Medium
Face to Face
Duration60 minutes
Interview date9 Aug 2019
Coding problem1

First he asked me to tell about myself, then he asked me some OOPS Concepts,difference in shallow copy and deep copy,
asked me to write a code for boundary traversal of binary tree.

1. Boundary Traversal of Binary Tree

Hard
20m average time
85% success
0/120
Asked in companies
Goldman SachsOYOExpedia Group

You are given a binary tree having 'n' nodes.


The boundary nodes of a binary tree include the nodes from the left and right boundaries and the leaf nodes, each node considered once.


Figure out the boundary nodes of this binary tree in an Anti-Clockwise direction starting from the root node.


Example :
Input: Consider the binary tree A as shown in the figure:

alt text

Output: [10, 5, 3, 7, 18, 25, 20]

Explanation: As shown in the figure

The nodes on the left boundary are [10, 5, 3]

The nodes on the right boundary are [10, 20, 25]

The leaf nodes are [3, 7, 18, 25].

Please note that nodes 3 and 25 appear in two places but are considered once.
Try solving now
03
Round
Easy
Face to Face
Duration60 minutes
Interview date9 Aug 2019
Coding problem2

The second tech interview lasted for about an hour and half. First he asked me to tell about myself. Then he asked me how my first interview was. He then asked me where should I start, data structures, databases, to which I replied anywhere.
He started asking questions about C. He asked difference between call by pointer and call by reference. Whether a function can be defined as
void function(int &x, int &y);
Then he asked what is volatile data type in C. Then about the static data class.
He also asked me to write a program to find length of a string.
Then he asked about how functions in C work. How does the program know where to go back after a function is over, etc.
He then asked me if I knew C++, I said no. So he continued to ask a few questions on data structures.
He then asked about the ACID properties which a good database must have. He asked how are transactions managed by a database, what are commits, how, in case of a power failure, data is reverted back, etc.
Then he asked me whether I like to work individually or in a team. I said in a team. He then gave me scenario where I have to decide between a project I am working on, whose deadline is approaching, and helping a friend working on another project whose deadline is also approaching, and asked me what would I do in such a case.

1. Middle Of Linked List

Easy
20m average time
80% success
0/40
Asked in companies
SamsungGoldman SachsOracle

Given a singly linked list of 'N' nodes. The objective is to determine the middle node of a singly linked list. However, if the list has an even number of nodes, we return the second middle node.

Note:
1. If the list is empty, the function immediately returns None because there is no middle node to find.
2. If the list has only one node, then the only node in the list is trivially the middle node, and the function returns that node.
Try solving now

2. Puzzle

There are 25 horses. There are 5 tracks. So at a time, only 5 horses can be raced. What is the minimum number of races to be conducted to decide the winner?

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 - 1
3 rounds | 3 problems
Interviewed by SAP Labs
2656 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 5 problems
Interviewed by SAP Labs
0 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 2 problems
Interviewed by SAP Labs
1752 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 5 problems
Interviewed by SAP Labs
1080 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
115097 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
58238 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
35147 views
7 comments
0 upvotes