Add office photos
Engaged Employer

ShareChat

3.6
based on 588 Reviews
Filter interviews by

Think Gas Ludhiana Interview Questions and Answers

Updated 5 Feb 2024

Q1. Flood Fill Algorithm Task

Assist Ninja in altering the color of a specific region in his photo. Given the image as a 2D array where each pixel is a positive integer, update the color of a specified pixel and th...read more

Ans.

The Flood Fill Algorithm is used to change the color of a particular region in an image and all its adjacent same-colored pixels.

  • The image is represented as a 2D array of positive integers

  • The starting pixel and new color are given

  • Adjacent pixels are connected in up, down, left, or right directions

  • Diagonal pixels are not considered adjacent

  • Implement the Flood Fill Algorithm to replace the color of the given pixel and its adjacent same-colored pixels with the new color

  • Repeat th...read more

View 1 answer

Q2. Network Delay Time Problem Statement

Given a network of nodes numbered from 1 to 'N', and 'M' edges. Each edge is represented by three values (u, v, w) where 'u' and 'v' are nodes, and 'w' is an integer represe...read more

Add your answer

Q3. Saving Money Problem Statement

Ninja is adventurous and loves traveling while being mindful of his expenses. Given a set of 'N' stations connected by 'M' trains, each train starting from station 'A' and reachin...read more

Add your answer

Q4. Flip Bit to Win Problem Statement

You are given a task to help ninjas maximize their practice area in a dense forest represented by a sequence of trees (1s) and empty places (0s) in the binary representation of...read more

Add your answer
Discover Think Gas Ludhiana interview dos and don'ts from real experiences

Q5. Postfix to Prefix Conversion Problem

Ninja has been given a Postfix expression and requires assistance in converting it to a Prefix expression.

A Postfix expression is formatted such that the operator follows t...read more

Add your answer

Q6. Kruskal’s Minimum Spanning Tree Algorithm Problem Statement

You are given a connected undirected weighted graph. Your task is to determine the weight of the minimum spanning tree of this graph.

A minimum spanni...read more

Ans.

The task is to find the weight of the minimum spanning tree of a given connected undirected weighted graph.

  • Implement Kruskal's algorithm to find the minimum spanning tree

  • Use a disjoint set data structure to keep track of connected components

  • Sort the edges in non-decreasing order of their weights

  • Iterate through the sorted edges and add them to the minimum spanning tree if they don't create a cycle

  • Return the sum of weights of the edges in the minimum spanning tree

Add your answer

Q7. Merge Sort Problem Statement

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.

Explanation:

The Merge Sort algorit...read more

Ans.

The task is to implement the merge sort algorithm to sort a given sequence of numbers in non-descending order.

  • Merge sort is a divide and conquer algorithm that recursively divides the input array into two halves until the size becomes 1.

  • Then it merges the two sorted halves to produce a single sorted array.

  • The time complexity of merge sort is O(n log n), where n is the size of the input array.

  • The algorithm is efficient for large data sets and guarantees a stable sort.

  • The imple...read more

Add your answer

Q8. Dice Throws Problem Statement

You are given D dice, each having F faces numbered from 1 to F. The task is to determine the number of possible ways to roll all the dice such that the sum of the face-up numbers e...read more

Add your answer

Q9. Safe Nodes in the Graph

You are provided with a matrix/list called 'EDGES' representing 'E' edges of a directed graph with 'N' nodes. Starting from a node 'START', a character named Ninja walks along a directed...read more

Add your answer

More about working at ShareChat

#3 Best Tech Startup - 2022
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Developer Intern Interview Questions from Similar Companies

3.9
 • 46 Interview Questions
4.4
 • 30 Interview Questions
3.6
 • 14 Interview Questions
3.7
 • 12 Interview Questions
3.8
 • 10 Interview Questions
4.0
 • 10 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 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