ShareChat
Think Gas Ludhiana Interview Questions and Answers
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
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
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
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
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
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
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
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
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
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
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
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
More about working at ShareChat
Top Software Developer Intern Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month