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

SDE - 1

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

Interview preparation journey

expand-icon
Preparation
Duration: 2 months
Topics: Data Structure and Algorithms, OOPS, System Design, Java.
Tip
Tip

Tip 1 : Do at least 2 projects
Tip 2 : Practice coding questions
Tip 3 : Have good knowledge on at least one programming language

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

Tip 1 : Have good knowledge on what ever skills are mentioned in resume
Tip 2 : Have at least 3 projects

Interview rounds

01
Round
Medium
Online Coding Interview
Duration60 minutes
Interview date24 Jul 2019
Coding problem1

1. Spiral matrix

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

You are given a 2-D array 'MATRIX' of dimensions N x M, of integers. You need to return the spiral path of the matrix.

Example Of Spiral Path:

Spiral path of a matrix

Problem approach

C
Create a recursive function that takes a matrix and some variables (k – starting row index, m – ending row index, l – starting column index, n – ending column index) as parameters
Check the base cases (starting index is less than or equal to ending index) and print the boundary elements in clockwise manner
Print the top row, i.e. Print the elements of kth row from column index l to n, and increase the count of k.
Print the right column, i.e. Print the last column or n-1th column from row index k to m and decrease the count of n.
Print the bottom row, i.e. if k > m, then print the elements of m-1th row from column n-1 to l and decrease the count of m
Print the left column, i.e. if l < n, then print the elements of lth column from m-1th row to k and increase the count of l.
Call the function recursively with the values of starting and ending indices of rows and columns.

Try solving now
02
Round
Medium
Face to Face
Duration60 minutes
Interview date24 Jul 2019
Coding problem2

1. Find K-th smallest Element in BST

Easy
15m average time
85% success
0/40
Asked in companies
SAP LabsGoldman SachsVisa

Given a binary search tree and an integer ‘K’. Your task is to find the ‘K-th’ smallest element in the given BST( binary search tree).

BST ( binary search tree) -

If all the smallest nodes on the left side and all the greater nodes on the right side of the node current node.

Example -

alt text

Order of elements in increasing order in the given BST is - { 2, 3, 4, 5, 6, 7, 8, 10 }

Suppose given ‘K = 3’ then 3rd smallest element is ‘4’.

Suppose given ‘K = 8’ then 8th smallest element is ‘10’.

Note:
1. You are not required to print the output explicitly, it has already been taken care of. Just implement the function and return the ‘K-th’ smallest element of BST.
2. You don’t need to return ‘K-th’ smallest node, return just value of that node. 
3. If ‘K-th’ smallest element is not present in BST then return -1.
Problem approach

Traverse the node from root to left recursively until left is NULL.
The node whose left is NULL is the node with minimum value.

Try solving now

2. Delete Node In BST

Moderate
10m average time
90% success
0/80
Asked in companies
AdobeSAP LabsMakeMyTrip

You have been given a Binary Search Tree of integers with ‘N’ nodes. You are also given data of a node of this tree. Your task is to delete the given node from the BST.


A binary search tree (BST) is a binary tree data structure that has the following properties:

• The left subtree of a node contains only nodes with data less than the node’s data.

• The right subtree of a node contains only nodes with data greater than the node’s data.

• Both the left and right subtrees must also be binary search trees.
Example:
For the given BST, if we want to delete the node with data 5 :

Input

The modified BST will be:

Ouput

Please notice that another valid answer is:

Output

Note :

1. The node which we want to delete will always be present in the given tree.

2. If after deletion the tree becomes empty, print -1.
Problem approach

Compare the value of key with the value of root. If the key > root -> value, recursively traverse the right subtree.
If key < root -> value, recursively traverse the left subtree.
While traversing if key == root->value, we need to delete this node:
If the node is a leaf, make root = NULL.
If the node is not a leaf and has the right child, recursively replace its value with the successor node and delete its successor from its original position.
If the node is not a leaf and has left child, but not right child, recursively replace its value by predecessor node and delete its predecessor from its original position.
Return root

Try solving now
03
Round
Medium
Face to Face
Duration50 minutes
Interview date24 Jul 2019
Coding problem1

1. System Design Question

Suppose there is a sea in which there are fishes and there is a fisherman who wants to
catch those fishes he has a thread he throws it into the sea with some force. So design a
game with these functionalities considering how far will the thread go and whether he
can catch the fishes or not.

04
Round
Easy
HR Round
Duration40 minutes
Interview date24 Jul 2019
Coding problem1

1. Basic HR Questions

1. Why SAP?
2. What if we don’t select you?
3. What if we select you?
4. Why should we hire you?
5. How will you adapt to new technologies in SAP?

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
3 rounds | 5 problems
Interviewed by SAP Labs
867 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 2 problems
Interviewed by SAP Labs
1752 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