Add office photos
Gainsight logo
Employer?
Claim Account for FREE

Gainsight

4.0
based on 105 Reviews
Video summary
Filter interviews by

20+ Gainsight Interview Questions and Answers

Updated 17 Jan 2025

Q1. A matrix consists of integers. A bomb has to be dropped at a cell in the matrix and its impact will get cascaded to the all the adjacent (top, bottom, right, left) cells if the adjacent cell has value 1 greater...

read more
Ans.

Find minimum bombs to clear matrix by cascading impact to adjacent cells with value 1 greater than the bombed cell.

  • Create a 2D matrix of integers

  • Iterate through each cell and drop a bomb, then check its adjacent cells

  • If an adjacent cell has value 1 greater than the bombed cell, drop a bomb on that cell as well

  • Repeat until no more cells can be bombed

  • Count the number of bombs dropped to clear the matrix

Add your answer
right arrow

Q2. Print the nodes which are at the boundaries of a binary tree. (Leaf Nodes + Top view)

Ans.

Print the nodes at the boundaries of a binary tree (leaf nodes + top view).

  • Traverse the tree in pre-order and keep track of the level of each node

  • Add the leftmost and rightmost nodes of each level to the result

  • For top view, traverse the tree in level-order and add the first node of each level to the result

Add your answer
right arrow

Q3. Connecting Ropes with Minimum Cost

You are given 'N' ropes, each of varying lengths. The task is to connect all ropes into one single rope. The cost of connecting two ropes is the sum of their lengths. Your obj...read more

Ans.

The problem is to connect N ropes of different lengths into one rope with minimum cost.

  • Sort the array of rope lengths in ascending order.

  • Initialize a variable to keep track of the total cost.

  • While there are more than one rope remaining, take the two shortest ropes and connect them.

  • Add the cost of connecting the two ropes to the total cost.

  • Replace the two shortest ropes with the connected rope.

  • Repeat the above steps until only one rope remains.

  • Return the total cost as the mini...read more

Add your answer
right arrow

Q4. Ninja and Substrings Problem Statement

Ninja has to determine all the distinct substrings of size two that can be formed from a given string 'STR' comprising only lowercase alphabetic characters. These substrin...read more

Ans.

The task is to find all the different possible substrings of size two that appear in a given string as contiguous substrings.

  • Iterate through the string and extract substrings of size two

  • Store the substrings in an array

  • Return the array of substrings

Add your answer
right arrow
Discover Gainsight interview dos and don'ts from real experiences

Q5. Bipartite Graph Problem Statement

Determine if a given graph is bipartite. A graph is bipartite if its vertices can be divided into two independent sets, 'U' and 'V', such that every edge ('u', 'v') connects a ...read more

Ans.

The function checks whether a given graph is bipartite or not.

  • A bipartite graph can be divided into two independent sets such that every edge connects a vertex from one set to the other.

  • We can use graph coloring algorithm to check if the graph is bipartite.

  • Start by coloring the first vertex with one color and all its neighbors with the other color.

  • Continue coloring the remaining vertices, making sure that no adjacent vertices have the same color.

  • If at any point, we find that ...read more

Add your answer
right arrow

Q6. DFS Traversal Problem Statement

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 'GRAPH' m...read more

Ans.

The question asks to print the DFS traversal of an undirected and disconnected graph.

  • Implement a Depth First Search (DFS) algorithm to traverse the graph.

  • Use a visited array to keep track of visited vertices.

  • For each unvisited vertex, start a DFS traversal and print the connected component.

  • Sort the vertices of each connected component in ascending order before printing.

Add your answer
right arrow
Are these interview questions helpful?

Q7. Dependency Injection & IOC in Spring

Ans.

Dependency Injection & IOC in Spring

  • Dependency Injection is a design pattern that allows objects to be loosely coupled and easily testable

  • In Spring, IOC (Inversion of Control) is used to manage dependencies and inject them into objects at runtime

  • IOC container in Spring is responsible for creating and managing objects and their dependencies

  • Spring supports different types of dependency injection such as constructor injection, setter injection, and field injection

Add your answer
right arrow
Q8. What happens when you call a function using the new keyword?
Ans.

Calling a function using the new keyword creates a new instance of the function's constructor.

  • Creates a new empty object

  • Binds 'this' to the new object

  • Adds a property to the new object called '__proto__' which points to the constructor function's prototype object

  • Returns the new object

Add your answer
right arrow
Share interview questions and help millions of jobseekers 🌟
man with laptop

Q9. merge sort explanation

Ans.

Merge sort is a divide and conquer algorithm that divides the input array into two halves, sorts them recursively, and then merges them back together in sorted order.

  • Divide the array into two halves

  • Recursively sort each half

  • Merge the sorted halves back together

Add your answer
right arrow

Q10. Buy stock sell problem

Ans.

The Buy stock sell problem involves finding the maximum profit that can be obtained by buying and selling stocks.

  • Iterate through the array of stock prices

  • Keep track of the minimum price seen so far

  • Calculate the profit by subtracting the minimum price from the current price

  • Update the maximum profit if the calculated profit is greater

  • Return the maximum profit

Add your answer
right arrow
Q11. How can you import all exports of a file as an object in JavaScript?
Ans.

You can import all exports of a file as an object in JavaScript using the 'import * as' syntax.

  • Use the 'import * as' syntax followed by the object name and 'from' keyword to import all exports of a file as an object.

  • For example: import * as myExports from './myFile.js';

  • You can then access the exports using dot notation, like myExports.myFunction().

Add your answer
right arrow

Q12. 1. Find triplet in an array to sum up to a given number?

Ans.

Find triplet in an array to sum up to a given number.

  • Sort the array in ascending order.

  • Iterate through the array and fix the first element.

  • Use two pointers approach to find the other two elements that sum up to the given number.

View 1 answer
right arrow
Q13. What is the purpose of the 'this' operator in JavaScript?
Ans.

The 'this' operator in JavaScript refers to the current context or object.

  • Refers to the current object or context in which a function is being executed

  • Can be used to access properties and methods of the current object

  • The value of 'this' is determined by how a function is called

Add your answer
right arrow
Q14. How are observables different from promises?
Ans.

Observables are streams that can emit multiple values over time, while promises can only emit a single value.

  • Observables can emit multiple values over time, while promises can only emit a single value.

  • Observables are cancellable, while promises are not.

  • Observables support operators like map, filter, and reduce for transforming data streams, while promises do not.

  • Observables are lazy, meaning they do not run until they are subscribed to, while promises start executing as soon ...read more

Add your answer
right arrow

Q15. SQL query of finding aggregate salary for the division

Ans.

SQL query to find aggregate salary for a division

  • Use the GROUP BY clause to group the employees by division

  • Use the SUM function to calculate the total salary for each division

  • Include the division column in the SELECT statement

  • Example: SELECT division, SUM(salary) AS total_salary FROM employees GROUP BY division

Add your answer
right arrow
Q16. What are arrow functions in JavaScript?
Ans.

Arrow functions are a concise way to write functions in JavaScript.

  • Arrow functions are defined using the '=>' syntax.

  • They have a shorter syntax compared to traditional function expressions.

  • They do not have their own 'this' keyword, instead they inherit it from the parent scope.

  • Example: const add = (a, b) => a + b;

Add your answer
right arrow
Q17. What is AOT compilation in Angular?
Ans.

AOT compilation in Angular stands for Ahead-of-Time compilation, which compiles Angular templates and components during the build process.

  • AOT compilation improves the performance of Angular applications by pre-compiling the templates and components before the browser downloads and runs them.

  • It detects template errors during the build process rather than at runtime, leading to faster rendering and reduced bundle size.

  • AOT compilation eliminates the need for the Angular compiler...read more

Add your answer
right arrow

Q18. Difference between Abstract class vs Interface?

Ans.

Abstract class is a class that can have both abstract and non-abstract methods while Interface only has abstract methods.

  • Abstract class can have constructors while Interface cannot.

  • A class can implement multiple interfaces but can only inherit from one abstract class.

  • Abstract class can have instance variables while Interface cannot.

  • Abstract class can provide default implementation for some methods while Interface cannot.

  • Example of Abstract class: Animal class with abstract me...read more

Add your answer
right arrow

Q19. 2. Print a star pattern?

Ans.

Printing a star pattern using loops in programming.

  • Use nested loops to print the pattern

  • The outer loop controls the number of rows

  • The inner loop controls the number of stars to be printed in each row

  • Use string concatenation to build the pattern

  • Example: for a pattern with 5 rows, the first row will have 1 star, the second row will have 2 stars, and so on

Add your answer
right arrow

Q20. Implementation of queue using stack

Ans.

Implement a queue using two stacks

  • Use two stacks - one for enqueue operation and one for dequeue operation

  • For enqueue operation, push elements into the first stack

  • For dequeue operation, if the second stack is empty, pop all elements from the first stack and push into the second stack, then pop from the second stack

  • Example: Enqueue 1,2,3 -> Stack1: [1,2,3], Dequeue -> Stack2: [3,2,1], Dequeue -> 1

Add your answer
right arrow

Q21. What is self interdection

Ans.

Self-intersection occurs when a curve or surface intersects itself at a point.

  • Self-intersection can occur in computer graphics when rendering complex shapes.

  • It can also occur in geometry when analyzing curves and surfaces.

  • Self-intersection can lead to rendering artifacts or inaccuracies in calculations.

Add your answer
right arrow

Q22. What is the phython

Ans.

Python is a high-level programming language known for its simplicity and readability.

  • Python is an interpreted language, meaning code is executed line by line.

  • It supports multiple programming paradigms like procedural, object-oriented, and functional programming.

  • Python has a large standard library and a thriving community with many third-party libraries available.

  • It is widely used in web development, data science, artificial intelligence, and more.

  • Example: print('Hello, World!...read more

Add your answer
right arrow

Q23. Why this in python

Ans.

Python is a versatile, easy-to-read language with a large community and extensive libraries.

  • Python has a simple syntax that makes it easy to learn and read.

  • Python has a large community of developers, making it easy to find support and resources.

  • Python has a wide range of libraries and frameworks for various applications, such as web development, data analysis, and machine learning.

Add your answer
right arrow

Q24. Why the codeing

Ans.

Coding allows me to solve complex problems, create innovative solutions, and continuously learn and improve my skills.

  • Coding enables me to automate tasks and processes, increasing efficiency and productivity.

  • It provides a creative outlet for problem-solving and allows me to build practical applications.

  • Coding opens up opportunities for collaboration with other developers and working on exciting projects.

  • It is a valuable skill in today's technology-driven world, with high dema...read more

Add your answer
right arrow

Q25. DSA stack problem

Ans.

Implement a stack using arrays with push, pop, and peek operations.

  • Create an array to store the elements of the stack

  • Implement push operation by adding elements to the end of the array

  • Implement pop operation by removing the last element from the array

  • Implement peek operation by returning the last element of the array without removing it

Add your answer
right arrow

Q26. SOC processes and techniques

Ans.

SOC processes and techniques involve monitoring, detecting, and responding to cybersecurity threats.

  • Continuous monitoring of network traffic and system logs

  • Utilizing security information and event management (SIEM) tools

  • Implementing threat intelligence feeds for proactive defense

  • Incident response planning and execution

  • Regular security assessments and penetration testing

Add your answer
right arrow
Contribute & help others!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos

Interview Process at Gainsight

based on 26 interviews
Interview experience
3.7
Good
View more
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Interview Questions from Similar Companies

Reliance Industries  Logo
4.0
 • 637 Interview Questions
Maruti Suzuki Logo
4.2
 • 370 Interview Questions
Hewlett Packard Enterprise Logo
4.2
 • 177 Interview Questions
JLL Logo
4.1
 • 166 Interview Questions
CBRE Logo
4.2
 • 165 Interview Questions
Hyundai Motor India Limited Logo
4.3
 • 138 Interview Questions
View all
Recently Viewed
SALARIES
C-Zentrix
SALARIES
Incubyte
INTERVIEWS
Incubyte
No Interviews
INTERVIEWS
Eclat Health Solutions
No Interviews
SALARIES
Gainsight
SALARIES
C-Zentrix
SALARIES
Celebal
INTERVIEWS
Einfochips
No Interviews
INTERVIEWS
Celebal
No Interviews
INTERVIEWS
Celebal
No Interviews
Top Gainsight Interview Questions And Answers
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter