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

SDE - Intern

Innovaccer
upvote
share-icon
2 rounds | 6 Coding problems

Interview preparation journey

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

Tip 1 : Prepare System Design
Tip 2 : Practice DSA Questions properly
Tip 3 : Practice OOPS and DBMS Concepts

Application process
Where: Naukri
Eligibility: 7+ CGPA, Good knowledge of DSA
Resume Tip
Resume tip

Tip 1 : Your Resume should consist mainly of skills, projects, and achievements. Projects would play a crucial part in your interview and you should have at least one most relevant and good project that shows how strong your concepts are in development.
Tip 2 : The most important tip is that never lie on your resume If you have worked upon some technology for the project part only and don't know the proper depth you could write basics only in your resume.

Interview rounds

01
Round
Medium
Online Coding Test
Duration90 minutes
Interview date21 Feb 2021
Coding problem4

questions mostly were based on DS Algo.There were 4 DS Algo questions ranging from easy to medium in difficulty.

1. Best time to buy and sell stock

Moderate
30m average time
72% success
0/80
Asked in companies
InnovaccerTechwave ConsultingPiramal Group

You are given an array of integers 'prices' of size 'n', where ‘prices[i]’ is the price of a given stock on an ‘i’-th day. You want to maximize the profit by choosing a single day to buy one stock and a different day to sell that stock.


Please note that you can’t sell a stock before you buy one.


Problem approach

First, think about what we can do on day i? You either have one stock or you don't on day i. For each case, you have two options, making a total of four possible actions on day i:

you have 1 stock and you sell it
you have 1 stock and you do nothing
you have 0 stock and you buy stock i
you have 0 stock and you do nothing
As you can imagine, these four actions are correlated between day i-1 and day i. For example, if you take action 1 on day i, you then have either taken action 2 or 3 on day i-1 but not 1 or 4. In precise, two consecutive days are related as follows:

if you take action 1 on day i ==> you have either taken action 2 or 3 on day i-1
if you take action 2 on day i ==> you have either taken action 2 or 3 on day i-1
if you take action 3 on day i ==> you must have taken action 4 on day i-1 (you can not sell on day i-1 due to cool down)
if you take action 4 on day i ==> you have either taken action 1 or 4 on day i-1
Now you want to maximize your total profit, but you don't know what action to take on day i such that you get the total maximum profit, so you try all 4 actions on every day. Suppose you take action 1 on day i, since there are two possible actions on day i-1, namely actions 2 and 3, you would definitely choose the one that makes your profit on day i more. Same thing for actions 2 and 4. So we now have an iterative algorithm.

Before coding, one detail to emphasize is that the initial value on day 0 is important. You basically cannot take action 1, so the corresponding profits should be 0. You cannot take action 2 in practice, but you cannot set up the profit to 0, because that means you don't have a stock to sell on day 1. Therefore, the initial profit should be negative value of the first stock. You can also think of it as you buy the stock on day -1 and do nothing on day 0.

Try solving now

2. Break The Prison

Moderate
0/80
Asked in companies
SalesforceInnovaccerMicrosoft

Ninja has been caged up in a prison and he is planning to escape from it. The prison's gate consists of horizontal and vertical bars that are spaced one unit apart, so the area of each hole between the bars is (1 * 1). Ninja manages to remove certain bars and make some of these holes bigger. Your task is to determine the area of the largest hole in the gate after the bars are removed.

For example, let us consider that the initial prison gate with ‘n’ = 8 horizontal and ‘m’ = 8 vertical bars, where the area of the biggest hole in the bars is (1 * 1). If we remove the 4th horizontal bar and 6th vertical bar, then our maximum area will be (2 * 2).

Problem approach

Initialize two sets, s1 & s2 to store the integers.
Iterate over the range [1, N+1] and store every integer in s1.
Similarly, iterate over the range [1, M + 1] and store every integer in s2.
Traverse the array H[] and remove all H[i] from s1.
Similarly, traverse the array V[] and remove all V[i] from s2.
Convert updated s1 and s2 sets into lists l1 and l2.
Sort both the lists in ascending order.
Traverse the list l1 and l2 and store the maximum distance between two neighbours as maxH and maxV respectively.
Print the product of maxH and maxV as the largest area.

Try solving now

3. Max Stack

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

You have to implement a special data structure “MAX_STACK” it would be a hybrid data structure of max heap and stack. Basically, it will have all the functionality of a stack in addition to it the max stack should also give max element in a stack in O(1). you have to implement the following functions:

specialPush(value): should push the value in the stack in O(1).
specialPop( ) : should pop the last element from the stack in O(1).
specialTop( ): should give the element at the top of the stack in O(1).
specialMax( ): should give the maximum element from all the elements that are currently present in the stack in O(1).

In addition it tries to construct it only using the stack data structure.

Four types of queries denote these operations:

Type 1 : for specialPush(value) operation.
Type 2 : for specialPop( ) operation.
Type 3 : for specialTop( ) operation.
Type 4 : for specialMax( ) operation.
Problem approach

Create an auxiliary stack, say ‘trackStack’ to keep the track of maximum element
Push the first element to both mainStack and the trackStack. 
Now from the second element, push the element to the main stack. Compare the element with the top element of the track stack, if the current element is greater than the top of trackStack then push the current element to trackStack otherwise push the top element of trackStack again into it. 
If we pop an element from the main stack, then pop an element from the trackStack as well. 
Now to compute the maximum of the main stack at any point, we can simply print the top element of Track stack.

Try solving now

4. Maximum In Sliding Windows Of Size K

Moderate
20m average time
80% success
0/80
Asked in companies
HSBCAmerican ExpressUber

Given an array/list of integers of length ‘N’, there is a sliding window of size ‘K’ which moves from the beginning of the array, to the very end. You can only see the ‘K’ numbers in a particular window at a time. For each of the 'N'-'K'+1 different windows thus formed, you are supposed to return the maximum element in each of them, from the given array/list.

Problem approach

Create an array max_upto and a stack to store indices. Push 0 in the stack.
Run a loop from index 1 to index n-1.
Pop all the indices from the stack, which elements (array[s.top()]) is less than the current element and update max_upto[s.top()] = i – 1 and then insert i in the stack.
Pop all the indices from the stack and assign max_upto[s.top()] = n – 1.
Create a variable j = 0
Run a loop from 0 to n – k, loop counter is i
Run a nested loop until j < i or max_upto[j] < i + k – 1, increment j in every iteration.
Print the jth array element.

Try solving now
02
Round
Medium
Video Call
Duration60 minutes
Interview date22 Mar 2022
Coding problem2

Interview was taken on Google Meet The interviewer introduced himself and he is an SDE-2 at Innovaccer. He started asking question on resume followed by questions on tech stack used in projects then he asked 1 difficult and 2 easy problem on data structures.

1. Search In Rotated Sorted Array

Moderate
30m average time
65% success
0/80
Asked in companies
PayPalFreshworksSAP Labs

Aahad and Harshit always have fun by solving problems. Harshit took a sorted array consisting of distinct integers and rotated it clockwise by an unknown amount. For example, he took a sorted array = [1, 2, 3, 4, 5] and if he rotates it by 2, then the array becomes: [4, 5, 1, 2, 3].

After rotating a sorted array, Aahad needs to answer Q queries asked by Harshit, each of them is described by one integer Q[i]. which Harshit wanted him to search in the array. For each query, if he found it, he had to shout the index of the number, otherwise, he had to shout -1.

For each query, you have to complete the given method where 'key' denotes Q[i]. If the key exists in the array, return the index of the 'key', otherwise, return -1.

Note:

Can you solve each query in O(logN) ?
Problem approach

when rotating the array, there must be one half of the array that is still in sorted order.
For example, 6 7 1 2 3 4 5, the order is disrupted from the point between 7 and 1. So when doing binary search, we can make a judgement that which part is ordered and whether the target is in that range, if yes, continue the search in that half, if not continue in the other half.

Try solving now

2. Distinct Subsequences

Easy
0/40
Asked in companies
AmazonMicrosoftInnovaccer

Given two strings S and T consisting of lower case English letters. The task is to count the distinct occurrences of T in S as a subsequence.

A subsequence is a sequence generated from a string after deleting some or no characters of the string without changing the order of the remaining string characters. (i.e. “ace” is a subsequence of “abcde” while “aec” is not).

For example, for the strings S = “banana” and T=”ban”, output is 3 as T appears in S as below three subsequences.

[ban], [ba n], [b an ]

Problem approach

Used Memoization.
since we are finding s2 subsequences in s1. So at any point of execution, if s1.length() becomes lesser then s2.length()

Try solving now

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 the purpose of the return keyword?

Choose another skill to practice
Similar interview experiences
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Innovaccer
1816 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 3 problems
Interviewed by Innovaccer
1002 views
0 comments
0 upvotes
company logo
Data Analyst
2 rounds | 3 problems
Interviewed by Innovaccer
1483 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Innovaccer
787 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Amazon
15556 views
4 comments
0 upvotes
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by Microsoft
15417 views
1 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Amazon
10180 views
2 comments
0 upvotes