i
SAP
Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards
Filter interviews by
I applied via Campus Placement and was interviewed in Aug 2024. There were 3 interview rounds.
45 minutes
arrays, strings,
SHL
To find number of nodes in a tree, perform a depth-first or breadth-first traversal and count the nodes. Time complexity is O(n).
Perform a depth-first or breadth-first traversal of the tree
Count the nodes as you traverse the tree
Time complexity is O(n) where n is the number of nodes in the tree
Abstraction is the concept of hiding complex implementation details and showing only the necessary information.
Abstraction allows developers to focus on the essential features of an object or system.
It helps in reducing complexity and improving efficiency in software development.
Implement abstraction in programming by using abstract classes and interfaces.
Example: In a car, we don't need to know the internal workings o...
The minimum number of coins to reach a target amount can be calculated using dynamic programming.
Use dynamic programming to calculate the minimum number of coins needed to reach the target amount.
Start by initializing an array to store the minimum number of coins needed for each amount from 0 to the target amount.
Iterate through the coin denominations and update the minimum number of coins needed for each amount based
Convert byte stream to human readable format without using library
Iterate through the byte stream and convert each byte to its ASCII character representation
Concatenate the ASCII characters to form the human readable format
Handle special characters and edge cases appropriately
I applied via Campus Placement and was interviewed in Jul 2021. There were 4 interview rounds.
I appeared for an interview in Jan 2021.
Round duration - 60 Minutes
Round difficulty - Easy
The first round was conducted on HackerRank platform and comprised of 10 MCQs and 2 coding questions.
Both the coding questions expected optimised solution (brute force wouldn’t work).
You are provided with an array of positive integers ARR
that represents the strengths of different “jutsus” (ninja techniques). You are also given the strength of the ene...
Count the number of subarrays whose combined strength matches the given enemy strength.
Iterate through all subarrays and calculate their sum to check if it matches the enemy strength.
Use two pointers technique to efficiently find subarrays with sum equal to the enemy strength.
Consider edge cases like when the enemy strength is 0 or when all elements in the array are equal to the enemy strength.
Your task is to determine the minimum number of platforms required at a railway station so that no train has to wait.
Given two arrays:
AT
- represent...Determine the minimum number of platforms needed at a railway station so that no train has to wait.
Sort the arrival and departure times arrays in ascending order.
Use two pointers to iterate through the arrays and keep track of the number of platforms needed.
Increment the number of platforms needed when a train arrives and decrement when a train departs.
Return the maximum number of platforms needed at any point.
Round duration - 60 Minutes
Round difficulty - Medium
The interview began with my introduction. The interviewer was very friendly and asked me a few questions about myself, my hobbies, etc.
You are given a sequence of numbers, ARR
. Your task is to return a sorted sequence of ARR
in non-descending order using the Merge Sort algorithm.
The Merge Sort...
Implement Merge Sort algorithm to sort a sequence of numbers in non-descending order.
Divide the input array into two halves recursively until each array has only one element
Merge the sorted halves to produce a completely sorted array
Time complexity of Merge Sort is O(n log n)
Example: Input: [3, 1, 4, 1, 5], Output: [1, 1, 3, 4, 5]
You are given an array of integers. The task is to remove all duplicate elements and return the array while maintaining the order in which the elements were provided.
Remove duplicates from an array while maintaining order.
Use a set to keep track of unique elements.
Iterate through the array and add elements to the set if not already present.
Convert the set back to an array to maintain order.
Round duration - 60 Minutes
Round difficulty - Easy
This was conducted on the Codepair platform on HackerRank and the interviewer was in face-time with me. There were 3 questions to be coded.
Given an unsorted array of integers, modify the array such that all the zeroes are moved to the end, while maintaining the order of non-zero elements as they appear or...
Move all zeroes to the end of an unsorted array while maintaining the order of non-zero elements.
Iterate through the array and maintain two pointers - one for non-zero elements and one for zeroes.
Swap non-zero elements with zeroes to move zeroes to the end of the array.
Maintain the relative order of non-zero elements while moving zeroes to the end.
Create a base class called Shape
that contains a field named shapeType
and a method printMyType
.
Implement two derived classes:
Create base class Shape with field shapeType and method printMyType. Implement Square and Rectangle classes with calculateArea method.
Create a base class Shape with shapeType field and printMyType method.
Implement Square and Rectangle classes inheriting from Shape.
Include additional fields and methods in Square and Rectangle classes.
Override printMyType method in Square and Rectangle classes to output their respective ...
Given an undirected and disconnected graph G(V, E)
, where V
is the number of vertices and E
is the number of edges, the connections between vertices are provided in the 'GR...
DFS traversal to find connected components in an undirected and disconnected graph.
Use Depth First Search (DFS) algorithm to traverse the graph and find connected components.
Maintain a visited array to keep track of visited vertices.
For each unvisited vertex, perform DFS to explore all connected vertices and form a connected component.
Repeat the process until all vertices are visited and print the connected components.
Tip 1 : Only write what your confident in cv
Tip 2 : Practice ds and algo problems with consistency
Tip 3 : Prepare for company specific questions
Tip 1 : Skills relevant to Job Description
Tip 2 : Be confident about things mentioned in cv
What people are saying about SAP
I appeared for an interview before Jan 2021.
Round duration - 60 minutes
Round difficulty - Easy
It was a 60 minute online coding round. 2 programming questions were asked in this round.
Your task is to determine the minimum number of platforms required at a railway station so that no train has to wait.
Given two arrays:
AT
- represent...Determine the minimum number of platforms needed at a railway station so that no train has to wait.
Sort the arrival and departure times arrays in ascending order.
Use two pointers to iterate through the arrays and keep track of the number of platforms needed.
Increment the number of platforms needed when a train arrives and decrement when a train departs.
Return the maximum number of platforms needed at any point in time.
Given two strings S1
and S2
comprised of lowercase alphabets, determine the list of characters that are uncommon between these strings. A character is considered unco...
Given two strings, find uncommon characters in lexicographical order.
Iterate through each character in both strings and keep track of their frequency using a hashmap.
Iterate through the hashmap and add characters with frequency 1 to the result list.
Sort the result list in lexicographical order and return it as the final output.
Round duration - 35 minutes
Round difficulty - Easy
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.
Your task is to interchange the values of two numbers given as variables 'X' and 'Y' without using a temporary variable or any additional variable.
Y...
Swap two numbers without using a temporary variable.
Use bitwise XOR operation to swap the values of X and Y without using a temporary variable.
The XOR operation works by toggling the bits of the numbers.
Example: X = 10, Y = 20. X = X XOR Y, Y = X XOR Y, X = X XOR Y. After swapping, X = 20, Y = 10.
Elements can be inserted at the back of the queue and deleted from the front.
To insert an element, use the 'enqueue' operation to add it to the back of the queue.
To delete an element, use the 'dequeue' operation to remove it from the front of the queue.
Insertion and deletion operations in a queue have a time complexity of O(1).
A deadlock is a situation in which two or more processes are unable to proceed because each is waiting for the other to release a resource.
Deadlock occurs when processes have acquired resources and are waiting for additional resources that are held by other processes.
Four necessary conditions for deadlock are mutual exclusion, hold and wait, no preemption, and circular wait.
Solutions to deadlock include prevention, avo...
Process synchronization is the coordination of multiple processes to ensure they do not interfere with each other while accessing shared resources.
Preventing race conditions by using synchronization mechanisms like locks, semaphores, and monitors
Ensuring mutual exclusion to prevent multiple processes from accessing shared resources simultaneously
Implementing synchronization to maintain the order of execution and avoid ...
C is a procedural programming language while C++ is an object-oriented programming language with features like classes and inheritance.
C is a procedural programming language, while C++ is a multi-paradigm language with support for object-oriented programming.
C does not support classes and objects, while C++ does.
C does not have features like inheritance and polymorphism, which are present in C++.
C is a subset of C++, m...
A friend function in OOP is a function that is not a member of a class but has access to its private and protected members.
Friend functions are declared inside a class with the 'friend' keyword.
They can access private and protected members of the class.
They are not member functions of the class, but have the same access rights as member functions.
Friend functions are often used for operator overloading or to allow exte...
Multithreading allows for concurrent execution of tasks, improving performance and responsiveness.
Improved performance by utilizing multiple CPU cores efficiently
Enhanced responsiveness as tasks can run concurrently without blocking each other
Better resource utilization by allowing tasks to be executed in parallel
Facilitates easier handling of complex tasks by breaking them into smaller threads
Examples: Web servers han...
Function overriding is when a subclass provides a specific implementation of a method that is already provided by its parent class.
Occurs in inheritance when a subclass has a method with the same name and parameters as a method in its superclass
The method in the subclass overrides the method in the superclass
Used to achieve runtime polymorphism in object-oriented programming
Example: class Animal { void sound() { System...
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.
SAP interview questions for designations
To determine if a point is inside a polygon, use the ray casting algorithm.
Create a line from the point to a point outside the polygon
Count the number of times the line intersects with the polygon edges
If the count is odd, the point is inside the polygon; otherwise, it is outside
The four storage classes in C are auto, register, static, and extern.
Auto: default storage class for all local variables
Register: used to define local variables that should be stored in a register instead of RAM
Static: used to define local variables that retain their value between function calls
Extern: used to declare a global variable that is defined in another file
i is stored in global data segment, j is stored in stack, k is stored in heap.
i is a global variable and is stored in the global data segment
j is a local variable and is stored in the stack
k is a pointer variable and is stored in the stack, while the memory it points to is allocated on the heap using malloc()
Use a hash table to store the words and check for existence in constant time.
Create a hash table with the words as keys and a boolean value as the value.
For each new word, check if it exists in the hash table. If it does, it has appeared before. If not, add it to the hash table.
Alternatively, use a set data structure to store only the unique words and check for existence in the set.
I appeared for an interview before Jan 2021.
Round duration - 60 Minutes
Round difficulty - Medium
The interviewer asked me 2 questions related to DS/Algo in this round . Both the questions were of Easy-Medium difficulty and I was also required to code them in a production ready manner.
You are provided with a binary tree consisting of N
nodes where each node has an integer value. The task is to determine the maximum sum achievable by a...
Find the maximum sum achievable by a simple path between any two nodes in a binary tree.
Traverse the binary tree to find all possible paths and calculate their sums.
Keep track of the maximum sum encountered during traversal.
Consider paths that may include the same node twice.
Implement a recursive function to explore all possible paths.
Handle cases where nodes have negative values.
Given two arrays A
and B
with sizes N
and M
respectively, both sorted in non-decreasing order, determine their intersection.
The intersection of two arrays in...
The problem involves finding the intersection of two sorted arrays efficiently.
Use two pointers to iterate through both arrays simultaneously.
Compare elements at the pointers and move the pointers accordingly.
Handle cases where elements are equal, and update the intersection array.
Return the intersection array as the result.
Round duration - 50 Minutes
Round difficulty - Medium
This round had 2 questions of DS/Algo to solve under 50 minutes and one question related to Operating Systems.
You are provided with an array or list ARR
containing N
positive integers. Your task is to determine the Next Greater Element (NGE) for each element in the array.
T...
Find the Next Greater Element for each element in an array.
Iterate through the array from right to left
Use a stack to keep track of elements with no greater element to the right
Pop elements from the stack until finding a greater element or stack is empty
Given three integers X
, C
, and Y
, where X
is the first term of an arithmetic sequence with a common difference of C
, determine if Y
is part of this arithmetic sequ...
Check if a given number is part of an arithmetic sequence with a given first term and common difference.
Calculate the arithmetic sequence using the formula: nth term = X + (n-1) * C
Check if Y is equal to any term in the sequence to determine if it belongs to the sequence
Return 'True' if Y belongs to the sequence, otherwise return 'False'
Processes are instances of programs in execution, while threads are smaller units within a process that can execute independently.
A process is a program in execution, consisting of code, data, and resources.
Threads are smaller units within a process that can execute independently.
Processes have their own memory space, while threads share the same memory space within a process.
Processes are heavyweight, while threads ar...
Round duration - 50 Minutes
Round difficulty - Medium
This round had 2 questions of DSA of Easy-Medium difficulty and at the end I was asked a Puzzle to check my general problem solving ability.
Given an array/list arr
of size n
, determine the maximum product possible by taking any subset of the array/list arr
. Return the result modulo 10^9+7
since the product ...
Find the maximum product of a subset of an array modulo 10^9+7.
Iterate through the array and keep track of the maximum positive product and minimum negative product encountered so far.
Handle cases where the array contains zeros separately.
Return the maximum product modulo 10^9+7.
Given a complete binary tree with 'N' nodes, your task is to determine the 'next' node immediately to the right in level order for each node in the given tree.
...Implement a function to update 'next' pointers in a complete binary tree.
Iterate level by level using a queue
Connect nodes at each level using 'next' pointers
Handle null nodes appropriately
Ensure the tree is a complete binary tree
Round duration - 50 Minutes
Round difficulty - Medium
This round consisted of 2 questions from DSA where I was first asked to explain my approach to the interviewer with proper complexity analysis and then code the problems. The interviewer was quite friendly and also provided me some hints when I was stuck.
Create a stack data structure that supports not only the usual push and pop operations but also getMin(), which retrieves the minimum element, all in O(1) time complexity witho...
Implement a stack with push, pop, top, isEmpty, and getMin operations in O(1) time complexity without using extra space.
Use two stacks - one to store the actual elements and another to store the minimum element at each level.
When pushing an element, check if it is smaller than the current minimum and update the minimum stack accordingly.
When popping an element, also pop from the minimum stack if the popped element is t...
You are given an integer array arr
of size N
. Your task is to split the array into the maximum number of subarrays such that the first and last occurre...
Given an array, split it into maximum subarrays with first and last occurrence of each element in a single subarray.
Iterate through the array and keep track of the first and last occurrence of each element.
Use a hashmap to store the indices of each element.
Split the array whenever the last occurrence of an element is found.
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.
Return all root to leaf node paths in a binary tree with row, col and value.
Traverse the binary tree recursively and keep track of the current path.
When a leaf node is reached, add the path to the result array.
Include row, col and value of each node in the path.
Use an array of strings to store the paths.
To get max value from a stack in O(1), maintain a separate stack to keep track of maximum values.
Create a separate stack to keep track of maximum values
Push the maximum value onto the stack whenever a new maximum is encountered
Pop the maximum value stack whenever the top element of the main stack is popped
Return the top element of the maximum value stack to get the maximum value in O(1)
To get max element from a queue in O(1) time complexity
Maintain a separate variable to keep track of the maximum element in the queue
Update the maximum element variable whenever a new element is added or removed from the queue
Return the maximum element variable when getMax() function is called
Find the Next Greatest Element to the right for each element in an array of strings.
Iterate through the array from right to left
Use a stack to keep track of elements
Pop elements from stack until a greater element is found
If no greater element is found, assign -1
Return the result array
To remove unnecessary parenthesis from an expression, we need to apply a set of rules to identify and eliminate them.
Identify and remove parenthesis around single variables or constants
Identify and remove parenthesis around expressions with only one operator
Identify and remove parenthesis around expressions with operators of equal precedence
Identify and remove parenthesis around expressions with operators of different ...
Find the maximum product of three integers in an array.
Sort the array in descending order.
Check the product of the first three numbers and the product of the first and last two numbers.
Return the maximum of the two products.
Find length of longest consecutive sub array forming an AP from given array of integers.
Sort the array in ascending order
Iterate through the array and find the longest consecutive sub array forming an AP
Use a variable to keep track of the length of the current consecutive sub array forming an AP
Use another variable to keep track of the length of the longest consecutive sub array forming an AP seen so far
I appeared for an interview before Sep 2020.
Round duration - 90 mintues
Round difficulty - Easy
Timing it is around 1 pm, Environment is very friendly.
Given an array Arr
consisting of N integers, your task is to find the equilibrium index of the array.
An index is considered as an equilibrium index if the sum of elem...
Find the equilibrium index of an array where sum of elements on left equals sum of elements on right.
Iterate through the array and calculate the total sum of elements.
For each index, calculate the sum of elements on the left and right side and check for equilibrium.
Return the left-most equilibrium index found, or -1 if none exist.
Given the schedule of N meetings with their start time Start[i]
and end time End[i]
, you need to determine which meetings can be organized in a single meeting room such ...
Given N meetings with start and end times, find the maximum number of meetings that can be organized in a single room without overlap.
Sort the meetings based on end times.
Iterate through the sorted meetings and select the next meeting whose start time is greater than or equal to the end time of the previous meeting.
Return the selected meetings in the order they are organized.
Round duration - 90 mintues
Round difficulty - Hard
Timing it is around 1 pm and Environment is good .
Overloading pre and post-increment operators in OOP involves defining special member functions for the class.
Define member functions for pre-increment (++obj) and post-increment (obj++) operators in the class.
For pre-increment, return a reference to the modified object after incrementing the value.
For post-increment, return a copy of the original object before incrementing the value.
Example: class Counter { int value; ...
Given an array of integers consisting of both positive and negative numbers, find the length of the longest subarray whose sum is zero. This problem will be presented wit...
Find the length of the longest subarray with zero sum in an array of integers.
Iterate through the array and keep track of the running sum using a hashmap.
If the running sum is seen before, it means there is a subarray with zero sum.
Calculate the length of the subarray with zero sum and update the maximum length found so far.
Tip 1 : Practice Atleast 500 Questions
Tip 2 : Do atleast 1 good projects
Tip 3 : You should be able to explain your project
Tip 1 : Have some projects on resume.
Tip 2 : Do not put false things on resume.
I appeared for an interview in Dec 2016.
based on 1 interview
1 Interview rounds
based on 3 reviews
Rating in categories
Software Developer
1.1k
salaries
| ₹8 L/yr - ₹32 L/yr |
Developer
893
salaries
| ₹10.3 L/yr - ₹34 L/yr |
Developer Associate
841
salaries
| ₹7.5 L/yr - ₹20.3 L/yr |
Senior Developer
571
salaries
| ₹13 L/yr - ₹51 L/yr |
Business Process Consultant
435
salaries
| ₹10 L/yr - ₹40 L/yr |
Oracle
SAS
Zoho
IBM