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

SDE - 1

Gainsight
upvote
share-icon
3 rounds | 8 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 4 months
Topics: Data Structures, Algorithms, Aptitude, OOPS
Tip
Tip

Tip 1 : Must do Previously asked Interviews as well as Online Test Questions.
Tip 2 : Must have good knowledge of DSA
Tip 3 : Do at least 2 good projects and you must know every bit of them.

Application process
Where: Referral
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
Video Call
Duration75 minutes
Interview date3 Feb 2022
Coding problem4

This round was primiarily to test the coding abilities of the candidate. You should have good coding practice to get through this round.

1. Search In A Row Wise And Column Wise Sorted Matrix

Moderate
15m average time
80% success
0/80
Asked in companies
AdobeNoBrokerOracle

You are given an 'N * N' matrix of integers where each row and each column is sorted in increasing order. You are given a target integer 'X'.


Find the position of 'X' in the matrix. If it exists then return the pair {i, j} where 'i' represents the row and 'j' represents the column of the array, otherwise return {-1,-1}


For example:
If the given matrix is:
[ [1, 2, 5],
  [3, 4, 9],
  [6, 7, 10]] 
We have to find the position of 4. We will return {1,1} since A[1][1] = 4.
Problem approach

Check if the current element is greater than x then decrease the count of j. Exclude the current column.
Check if the current element is less than x then increase the count of i. Exclude the current row.
If the element is equal, then print the position and end.
Print the Element is not found

Try solving now

2. BST Delete

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

You are given a binary search tree (BST) and a key value 'K'. You need to delete the node with value 'K'. It is guaranteed that a node has the value 'K'.

A binary search tree (BST), also called an ordered or sorted binary tree, is a rooted binary tree whose internal nodes each store a key greater than all the keys in the node's left subtree and less than those in its right subtree.

Note:
All the elements of the binary search tree are unique.
Problem approach

Completed all operations in o(h) complexity

Try solving now

3. Minimum Swaps To Make Identical Array

Moderate
0/80
Asked in companies
WalmartThought WorksAmazon

You are given two arrays, ‘A’ and ‘B’, with the same elements in a different order. Your task is to make ‘B’ identical to the ‘A’ by swapping the elements in array ‘B’. You have to find out the minimum number of swaps required.

For Example:
For the first test case, ‘A’ = [5, 6, 4, 10], ‘B’ = [4, 6, 10, 5], here in the ‘B’ we can swap 4 with 10 to form [10, 6, 4, 5] and we can then swap 10 with 5 to form the array [5, 6, 4, 10] which is identical to ‘A’. Hence the answer is 2.
Problem approach

Whenever the binary array has 1, we check if that index in array A has i+1 or not. If it does not contain i+1, we simply swap a[i] with a[i+1].

Try solving now

4. Inplace rotate matrix 90 degree

Easy
12m average time
80% success
0/40
Asked in companies
OracleAppleFacebook

You are given a square matrix of non-negative integers of size 'N x N'. Your task is to rotate that array by 90 degrees in an anti-clockwise direction without using any extra space.

For example:

For given 2D array :

    [    [ 1,  2,  3 ],
         [ 4,  5,  6 ],
         [ 7,  8,  9 ]  ]

After 90 degree rotation in anti clockwise direction, it will become:

    [   [ 3,  6,  9 ],
        [ 2,  5,  8 ],
        [ 1,  4,  7 ]   ]
Problem approach

First time with respect to the Main diagonal, next time rotate the resultant matrix with respect to the middle column, Consider the following illustration to have a clear insight into it.

Try solving now
02
Round
Easy
Video Call
Duration75 minutes
Interview date4 Nov 2022
Coding problem3

The interviewer asked my introduction, a Few Questions on O.O.P.S concepts, Deadlock and DBMS, 2 coding questions and 1 SQL query.

1. Container With Most Water

Moderate
15m average time
90% success
0/80
Asked in companies
MicrosoftAmazonSAP Labs

Given a sequence of ‘N’ space-separated non-negative integers A[1],A[2],A[3],......A[i]…...A[n]. Where each number of the sequence represents the height of the line drawn at point 'i'. Hence on the cartesian plane, each line is drawn from coordinate ('i',0) to coordinate ('i', 'A[i]'), here ‘i’ ranges from 1 to ‘N’. Find two lines, which, together with the x-axis forms a container, such that the container contains the most area of water.

Note :
1. You can not slant the container i.e. the height of the water is equal to the minimum height of the two lines which define the container.

2. Do not print anything, you just need to return the area of the container with maximum water.
Example

water-diagram

For the above Diagram, the first red marked line is formed between coordinates (2,0) and (2,10), and the second red-marked line is formed between coordinates (5,0) and (5,9). The area of water contained between these two lines is (height* width) = (5-2)* 9 = 27, which is the maximum area contained between any two lines present on the plane. So in this case, we will return 3* 9=27.
Problem approach

Used two pointer approach

Try solving now

2. Ninja Game

Hard
20m average time
75% success
0/120
Asked in companies
AmazonAtlassianMeesho

Ninja and his friend are playing a game. They are having ‘N’ piles and each pile contains ‘A[i]’ amount of stones in it. Ninja will make the first move.

In each move, a player can choose any pile and remove any number of stones ( at least one ) from that pile. The player who cannot make a move loses the game.

Assuming both players play optimally, output 1 if Ninja wins the game and 0 if Ninja loses the game.

Example :
N = 3
A = [ 3, 4, 5 ]

Explanation : 

One of the optimal ways to play the game is : 

Ninja removes 3 stones from the first pile : [ 0, 4, 5 ].
Friend removes 3 stones from the second pile : [ 0, 1, 5 ].
Ninja removes 3 stones from the third pile : [ 0, 1, 1 ].
Friend removes 1 stone from the second pile : [ 0, 0, 1 ].
Ninja removes 1 stones from the third pile : [ 0, 0, 0 ].

Thus Ninja wins the game here.
Problem approach

We want to reach the last cell of the dungeon which means that our health should be greater than 1 when we reach there. So the best way to calculate the minimum health required is by checking for the last cell and going our way upwards. The answer will be the value we get on arriving at the first cell

Try solving now

3. SQL Query

Write an SQL Query to obtain the second-highest salary from the list of employees

Problem approach

Tip 1 : Practice as many SQL questions as possible
Tip 2 : Share your thought process with the interviewer

03
Round
Easy
Video Call
Duration30 minutes
Interview date7 Feb 2022
Coding problem1

This round had both technical and managerial questions. this round was taken by Director of Engineering. Questions about projects, situated-based, and computer fundamentals were asked.

1. Theory Question

What happens when we click google.com?
How does youtube recommendation work
What are semaphores?

Problem approach

Tip 1 : Prepare for fundamentals well
Tip 2 : Prepare previously asked questions.

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 recursion?

Choose another skill to practice
Similar interview experiences
Associate Software Engineer
6 rounds | 4 problems
Interviewed by Gainsight
2563 views
0 comments
0 upvotes
Software Engineer
2 rounds | 5 problems
Interviewed by Gainsight
1046 views
0 comments
0 upvotes
SDE - 1
2 rounds | 5 problems
Interviewed by Gainsight
711 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 9 problems
Interviewed by Salesforce
3451 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
114579 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
57825 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
34961 views
7 comments
0 upvotes