Google New Grad Off Campus Interview Questions 2025 | India
Summary
This post details a comprehensive list of technical and behavioral questions encountered in a Google New Grad off-campus interview, targeting candidates for 2025 in India.
Full Experience
Google Technical Questions:
-
Given a positive integer represented as a string, and an integer K, find the largest subsequence of length K that you can form from the given string. For example if $s=4902,$ $k=3$ the highest subsequence formed is 902.
-
Given an array representing the distances that can be travelled on each particular day corresponding to indices, and a person has 2 options for each day - travel the given distance or take rest. If he travels, energy decreases by 1, and taking rest increases his energy by 1. Given the initial energy of the person, find the maximum distance that the person can travel.
-
We define an organic molecule by a list of atoms, and a list of bonds between any two of them. For example, the following formaldehyde molecule: $H-C(-H)=O$ and is represented as atoms: {1: 'C', 2: 'H', 3: 'H', 4: 'O'} bonds: [[1, 2], [1, 3], [1, 4], [1, 4]]. The input does not have to be strictly in this format, as long as it delivers the information.Given an input representing a molecule consisting only of Carbon, Oxygen, and Hydrogen atoms, determine if it's valid. A molecule is valid if every atom has the required number of bonds:C atoms require exactly 4 bonds. O atoms require exactly 2 bonds. H atoms require exactly 1 bond.
-
Given a network of cities represented in 2D format(co-ordinates), where each city is considered a router, this router passes information to all the other routes within its range and goes dead. All those routers that received this information will again pass the info within their range and this goes on.
a. Given source and destination routers, return if it is possible for information to reach the destination from the source.
b. Given source and destination routers, return the minimum range required so that information reaches the destination. (BS, maximum range is dist btw src and dest).
c. If the router sends information to the router at the shortest distance within its range, find if information can be passed to destination from the source.
-
Given some intervals of scheduled meetings (might be overlapping) and a
DoNotSchedule(DNS) slot interval, return an array of slots(non-overlapping, merge if required), representing the final meeting slots such that none of them intersects with DNS slot timings.
a. Follow-Up: If multiple, possibly intersecting DNS slots are given, return the same requirement.
-
Given an array of numbers, you have 2 options at each index, either add its value to your score, and move the index by that value, or skip that index and move to the next index.
a. Follow-Up: Return the path to that max. score achieved, report if an index is skipped or taken. (DP)
-
Minecraft game: It has 2 kinds of blocks - Torch and Wire. Torches have a power level of 16. Power can range from 0-16. Power gets transmitted to adjacent blocks, while being decremented by 1. Given a series of blocks, determine the max. power level of each block in a fn calculate_power(blocks). If it's a wire block and 2 diff power levels might be possible from diff torch sources, power is not summed, but the maximum value is taken into consideration. Given the following functions -
get_adjacent(block: Block) -> Sequence [Block] - Returns the list of blocks that are adjacent to given one.
get_power_level(block: Block) -> int - Returns the current power level associated with a block
set_power_level(block: Block, int) -> None - Sets the power level of a block to the specified value.
is_torch(block: Block) -> bool - Returns true if the block is a torch
a. Implement the calculate_power(blocks) that takes a set of blocks and returns the power of each block. (BFS - Floodfill type).
-
Given N players, and M games and their results. Return the players whose rank can be precisely determined.
a. Follow-Up: Return the ranks of these players. (Toposort - To determine rank use outdegree, but since the relation is transitive, (a wins over b, b wins over c, implies a wins over c), outdegree of adjacent nodes is also to be considered.
-
Given a network of nodes, connected in an undirected, unweighted fashion. One of these nodes is corrupted and has a virality value which represents the distance until which it can corrupt other nodes too. Given a source node, find the distance from this source to all the nodes that are reachable.
a. Follow-Up: If there are multiple corrupted nodes, find the distance to each reachable node from the source.
b. If edges are weighted, and virality of a node is also transferred to other nodes based on the edge weights, such that for example, if virality of a node is 5 and edge weight is 3, then transferred virality is 2.
-
A footpath is constructed with blocks of different colours. There can be contiguous blocks of the same colour. Given a particular colour, find the max length of contiguous block painted with this colour.
a. Follow-Up: Given q queries, each with a particular colour, return the above requirement for each colour.
b. If atmost m blocks can be repainted to maximise the answer, return the updated answer.
-
In a tree of 0's and 1's, an island is defined as a group of 1's that are surrounded by O's or are at the boundary. Find the no. of islands in the tree.
-
Given a list of city pairs that are connected by road. Travelling from any city to the connected city in these pairs always takes 1 hour. Every city is connected to every other city either directly or through other cities. All the cities are labelled with numbers starting with 1. If there is a city labelled with number N, then there will be exactly 1 city labelled with every number less than N. Few of the cities are blocked. We are also given a start city where we are and a destination city where we have to reach. We are given this list of these blocked cities. One can go from start to destination as long as the path between the start and the destination doesn't have a blocked city even though the start city or the destination city is blocked. Write a function that can give the least time to travel from start to destination.
-
Given an integer array of size N, 0-based indexing, and Q queries containing a range [l,r], both inclusive and indicate valid indices such that $l<=r$ For each query, choose a subset of indices in range [l,r], and subtract 1 from the array values of these selected indices. An array is called zero array if $A[i]=0$ for all $0<=i<N$ after Q operations. Implement a function to check whether it's possible to make a zero array or not after performing the given Q operations.
-
You and your friends are discussing about a sequence of numbers on blackboard. Each person might remember a part of sequence and each part might not be correct or not. Now everyone writes down the sequence of numbers they remember. And you are given the task of consolidating them and tell if there is a consensus or not. Here consensus means there is some valid sequence that is consistent with all the parts. For example, friends provide (1, 2, 15, 8), (2, 4, 7, 8). One person forgot 4,7 and other 1,15. Here consensus is there. Ex: 1, 2, 4, 7, 15, 8. Another example: (1, 6, 4), (4, 1). In this case there is no consensus. One person remembers 1 coming after 4 and another remembers 4 coming after 1 which is a contradiction.
-
There are some cakes and the coordinates of the top-left corner along with its area are given for each cake. All cakes are of square shape. Given a vector of cakes, draw a horizontal line such that it divides the area of cakes equally.
a. Class cake{ int top_leftx; int top_lefty; int area; }
b. Follow-Up: What if the coordinates and area is not integer value but is double, and horizontal line is also not an integer.
-
Given a binary tree with edge weights, disconnect the leaves from the root. You can remove any edges you want, but sum of edges removed must be minimum
a. Follow-Up: What if the tree is an n-ary tree
-
Given some chunks of files(1 to c), implement 3 functions:
→ join(user, vector ownedchunks) - Give the smallest missing positive number as user_ld to the user and store the given chunks under this user and return user_Id.
→ leave(user_Id) - Remove this user by removing user_Id and freeing up the chunks under him.
→ request(user_Id, chunkid) - Return a vector of userld's who own the given chunkid.
-
There was a question of bank with n customers and they can withdraw or deposit money. Once they start to serve the customer they will stop untill the money left in the bank is less than the withdrawal amount. Find max no of customer bank can serve. Initially bank has some X dollars.
-
Design a stack with operations push, pop, add where add adds the input number n to the top k elements of the stack.
-
Given a list of documents and a list of queries, a list of corrupt queries, find the number of documents that are corrupt. A document which has a corrupt query run on it is corrupt and all the queries of a corrupt document are considered corrupt
-
Given a field in the form of a grid of side $n\times n.$ fill the square with given crops where the count of each crop is given and they all sum up to $n^{\wedge}2$ 2.It's like suppose four types of crops are given, then the crops of same type have to be beside each other in a 2d array.Idaithe oka type of crops anni DFS chesthe vacheseyali atlaa fill cheyali ante immediate right left down top lo ekadaina undali.
-
Window is given of k element. Find the avg of k elements while removing n largest element from that window. (ambigous)
-
There is an array of Os and 1s. There is an API called query that returns true if there is a 1 in A[L, R and false otherwise. Given the size of the array, write a function that returns the position of all 1s.
-
given ar[] -> values of balls(can be -ve,+ve, 0). 2 players -> each Player can pick either 1 or 2 balls at once. Both players play optimally, value of balls picked gets added to the score of players, We have to make sure that player 1 wins and return max difference of (score of player1 - player2)
-
given a graph, each node contains pair{row,col}. matrix[m][n] -> contains houses(at pair{row,col}) and empty blocks, each house owner wants to plant in exactly one of the 4 neighbouring empty blocks, but there must be atmost 1 plant in each row and each col, return matrix after planting.
-
We are given a list of points in the plane. Write a function to return the area of the largest rectangle formed by any four points in the list.
-
Given an array A, a starting position S, as well as offset integer X. Return the final position of a jumping game which has the following rules:
➤ For every odd jump you have to jump left from current position (C) to the closest position CL, such that $A[CL]=A[C]+1$ For every even jump you have to jump right from the current position (C) to the closest position CR, such that $A[CR]=$ $A[C]+1.$
➤ If there is no valid position for next jump then stop jumping and return position C. ➤ For every successful jump, the array value at the position before jump (C) should
be incremented by X. $A[C]+=X$, then proceed to the next round at the new position.
a. Write a function which returns the position where you end after performing all suitable jumps.
b. Follow-Up: Discuss the edge cases, where there is a possibility of infinite loop- When does it occur and how will you tackle it?
-
There are sellers selling a product named "ABC". Every seller has their own price to sell this product for. You have to arrange the sellers in the order_book based on the ascending order of the price and if the price is the same then based on the timestamp in which they have arrived to this order_book.
→ Input: seller_id(which is unique), price and timestamp → Complete the below two functions:
insert(seller_id,price, timestamp) -> Inserts the sellers into order_book based on the above mentioned order
get_the_seller() -> Returns the seller_id with least price and removes the seller from the order_book
a. Follow-Up-1: What if the sellers get anxious and leave the order_book> How would you handle this?
b. If the price range is given for suppose 1 to 10000, and timestamps will be in ascending order, how would you optimise the above 2 functions?
-
Implement a class called Superstack that implements the stack interface: push(k), peek(), pop().Additionally the stack should implement the function sum()--> which returns The total sum of stack and inc(n,k)--> increment the bottom n elements by k.
-
Imagine we are on a parking garage. All day, car enters and exit. When a car enters it takes a ticket and when exits it returns the ticket. The machine prints the entry and exit on each ticket. At the end of the we have got a pile of tickets and we want to figure out how Many cars were there in the garage at each time of the day.
-
Given a grid which consists of only one exit and many walls and robots at each of the cell. Here #-->represents the wall and .--> represents the robot and E is the exit. At each cell which has robot return the direction (U/D/L/R) such that when robot follows the direction from each cell it should eventually reach the exit. (If the direction is down and it has a wall (#) at that place then it will remain in the same position). Robot can be anywhere on the dot in the grid.
Input:
######
#.#E.#
#....#
######
Follow UP- Return the set of commands such that if any robot follows the commands then it should pass the exit.
ex-UDULRDUL it is a command such that if we follow this every dot much pass the exit.
32. Wordle is a game where a player tries to guess a secret 5 letter word from the english dictionary.Every time the player guesses they get a clue. Our task is to create a wordle finder which helps the player by providing guesses for the secret word, given the last guess made by the player. Given access to the entire English dictionary of 5 letter word and these three letter 5-letter string inputs, generated from the players last guess.
Green: (G) letters mean that letter is both correct and in the right position
Yellow: (Y) letters means letter is in the word, but not at the right position
Red: (R) letters means the secret word does not contain the letter with an exception: If a guess contains a letter thats in the secret word and the guess has multiple instances of that letter, then the letter could appear in both Green/Yellow and Red.
Consider the case when the secret word is PLANE contains P and the guess APPLE contains the 2Ps. The first P is scored as Yellow while the second P as Red. Output the possible guesses for the secret word.
get_hints(green="PR_ _ _", yellow="_ _ M _ _", red = "_ _ _ ZF") →
[PRAMS, PRIME, PRIMI, PRIMO, PRIMP, PRIMS, PRISM, PROEM, PROMO, PROMS]
33. Each poem has a Rhyme Scheme. Where the last words of each line are-
Specialiazation (A)
Location (A)
Compile (B)
Trial (B)
Immolation (A)
3line poem-AAA, AAB, ABB, ABA, ABC.
Write a function which takes a short rhyme scheme and a long rhyme scheme and if possible extends the short one to match with the long one
EX-DEE ABBBA -> DEEED
34. Allocate books question in binary search but here it is double instead of int.
-
The member of states of UN are planning to send 2 people to the moon. Theuy want to be from the different countries. You will be given a list of pairs of astronauts IDs. Each pair is made of astronauts of same country. Determine how many pairs of astronauts from different countries they can choose from.
$n=4$ astronaut= [1,2], [2,3] ->3 pairs from [0,1], [0,2] and [0,3]
-
partition the array into two parts such that sum is equal and if needed you can also remove the elements.
Follow up- take that array now as circular. (Given a necklace with beats remove any beats such that two arrays sum is equal)
-
Given an array of positive and negative numbers. Find the max length of the window such that sum is $>=0$
-
longest increasing subsequence with difference k.
-
Given a stream of numbers. Find the median of them.
-
Given different trains with starting station, destination station, arrival time and destination time.Is it possible to reach from starting station to ending station or not??
-
Given two arrays A and B. IF you shuffle the entries in A then B is possible. Do the similar shuffle as of A in array C and find the corresponding B.
-
Given a compressed string, transform that into its decompressed form $a(b{3}c){2}f\rightarrow abbcabbcf$
Follow up- Given decompressed find its compressed form.
-
You should simplify an algebraic equation given like string $Ex: (a-b)+(b-c)=a-c$
-
Given cities in which some cities has data centres. Now you have to put a new data centre in a city such that min distance from this city to city which already has a data centre has to be maximised.
-
Given some free seats and occupied seats, return the longest free seats sequence.
-
Given a sequence of numbers, return the longest sequence in which all are consecutive numbers.
Follow up- Longest subsequence with difference atmost d
-
All possible sequences of 1s and 2s that summed upto n.
-
Then the actual question was
A class was given with a dictionary passing in its constructor
It has a method that tells the hash value for each of the word in the dictionary And another method is the one that i wrote calculating the score
Now i had to implement another method that returns the max score anagram for each of the word.I needed to implement a function first that calculates the score of a string The score is the total distance between each letter.
-
An acyclic graph was given, with utmost 3 neighbours and we have to find the vertex in the graph which can be the potential root of a binary tree.
Behavioural Questions:
- What will you do if your colleague takes credit for your work?
- What are your short-term and long-term goals?
- What will you do if you get into some clashes with your teammates?
- What was a tough thing you tackled in your internship and how did you do it?
- What was your greatest achievement in recent times?
- What would you do if you have problems with your colleague, if he is not cooperative?
- What will you do if you are not comfortable with the team, tech-stacks, etc. How would you change yourself or the situation?
- Describe a time when you had different opinion with your teammate. How did your team conclude the decision and how did you discuss different opinions and come up with the final decision?
- How will you handle hectic deadlines?
Interview Questions (58)
Given a positive integer represented as a string, and an integer K, find the largest subsequence of length K that you can form from the given string. For example if $s=4902, k=3$ the highest subsequence formed is 902.
Given an array representing the distances that can be travelled on each particular day corresponding to indices, and a person has 2 options for each day - travel the given distance or take rest. If he travels, energy decreases by 1, and taking rest increases his energy by 1. Given the initial energy of the person, find the maximum distance that the person can travel.
We define an organic molecule by a list of atoms, and a list of bonds between any two of them. For example, the following formaldehyde molecule: $H-C(-H)=O$ and is represented as atoms: {1: 'C', 2: 'H', 3: 'H', 4: 'O'} bonds: [[1, 2], [1, 3], [1, 4], [1, 4]]. The input does not have to be strictly in this format, as long as it delivers the information.Given an input representing a molecule consisting only of Carbon, Oxygen, and Hydrogen atoms, determine if it's valid. A molecule is valid if every atom has the required number of bonds:C atoms require exactly 4 bonds. O atoms require exactly 2 bonds. H atoms require exactly 1 bond.
Given a network of cities represented in 2D format(co-ordinates), where each city is considered a router, this router passes information to all the other routes within its range and goes dead. All those routers that received this information will again pass the info within their range and this goes on.
a. Given source and destination routers, return if it is possible for information to reach the destination from the source.
b. Given source and destination routers, return the minimum range required so that information reaches the destination. (BS, maximum range is dist btw src and dest).
c. If the router sends information to the router at the shortest distance within its range, find if information can be passed to destination from the source.
Given some intervals of scheduled meetings (might be overlapping) and a DoNotSchedule(DNS) slot interval, return an array of slots(non-overlapping, merge if required), representing the final meeting slots such that none of them intersects with DNS slot timings.
a. Follow-Up: If multiple, possibly intersecting DNS slots are given, return the same requirement.
Given an array of numbers, you have 2 options at each index, either add its value to your score, and move the index by that value, or skip that index and move to the next index.
a. Follow-Up: Return the path to that max. score achieved, report if an index is skipped or taken. (DP)
Minecraft game: It has 2 kinds of blocks - Torch and Wire. Torches have a power level of 16. Power can range from 0-16. Power gets transmitted to adjacent blocks, while being decremented by 1. Given a series of blocks, determine the max. power level of each block in a fn calculate_power(blocks). If it's a wire block and 2 diff power levels might be possible from diff torch sources, power is not summed, but the maximum value is taken into consideration. Given the following functions -
get_adjacent(block: Block) -> Sequence [Block] - Returns the list of blocks that are adjacent to given one.
get_power_level(block: Block) -> int - Returns the current power level associated with a block
set_power_level(block: Block, int) -> None - Sets the power level of a block to the specified value.
is_torch(block: Block) -> bool - Returns true if the block is a torch
a. Implement the calculate_power(blocks) that takes a set of blocks and returns the power of each block. (BFS - Floodfill type).
Given N players, and M games and their results. Return the players whose rank can be precisely determined.
a. Follow-Up: Return the ranks of these players. (Toposort - To determine rank use outdegree, but since the relation is transitive, (a wins over b, b wins over c, implies a wins over c), outdegree of adjacent nodes is also to be considered.
Given a network of nodes, connected in an undirected, unweighted fashion. One of these nodes is corrupted and has a virality value which represents the distance until which it can corrupt other nodes too. Given a source node, find the distance from this source to all the nodes that are reachable.
a. Follow-Up: If there are multiple corrupted nodes, find the distance to each reachable node from the source.
b. If edges are weighted, and virality of a node is also transferred to other nodes based on the edge weights, such that for example, if virality of a node is 5 and edge weight is 3, then transferred virality is 2.
A footpath is constructed with blocks of different colours. There can be contiguous blocks of the same colour. Given a particular colour, find the max length of contiguous block painted with this colour.
a. Follow-Up: Given q queries, each with a particular colour, return the above requirement for each colour.
b. If atmost m blocks can be repainted to maximise the answer, return the updated answer.
In a tree of 0's and 1's, an island is defined as a group of 1's that are surrounded by O's or are at the boundary. Find the no. of islands in the tree.
Given a list of city pairs that are connected by road. Travelling from any city to the connected city in these pairs always takes 1 hour. Every city is connected to every other city either directly or through other cities. All the cities are labelled with numbers starting with 1. If there is a city labelled with number N, then there will be exactly 1 city labelled with every number less than N. Few of the cities are blocked. We are also given a start city where we are and a destination city where we have to reach. We are given this list of these blocked cities. One can go from start to destination as long as the path between the start and the destination doesn't have a blocked city even though the start city or the destination city is blocked. Write a function that can give the least time to travel from start to destination.
Given an integer array of size N, 0-based indexing, and Q queries containing a range [l,r], both inclusive and indicate valid indices such that $l<=r$ For each query, choose a subset of indices in range [l,r], and subtract 1 from the array values of these selected indices. An array is called zero array if $A[i]=0$ for all $0<=i<N$ after Q operations. Implement a function to check whether it's possible to make a zero array or not after performing the given Q operations.
You and your friends are discussing about a sequence of numbers on blackboard. Each person might remember a part of sequence and each part might not be correct or not. Now everyone writes down the sequence of numbers they remember. And you are given the task of consolidating them and tell if there is a consensus or not. Here consensus means there is some valid sequence that is consistent with all the parts. For example, friends provide (1, 2, 15, 8), (2, 4, 7, 8). One person forgot 4,7 and other 1,15. Here consensus is there. Ex: 1, 2, 4, 7, 15, 8. Another example: (1, 6, 4), (4, 1). In this case there is no consensus. One person remembers 1 coming after 4 and another remembers 4 coming after 1 which is a contradiction.
There are some cakes and the coordinates of the top-left corner along with its area are given for each cake. All cakes are of square shape. Given a vector of cakes, draw a horizontal line such that it divides the area of cakes equally.
a. Class cake{ int top_leftx; int top_lefty; int area; }
b. Follow-Up: What if the coordinates and area is not integer value but is double, and horizontal line is also not an integer.
Given a binary tree with edge weights, disconnect the leaves from the root. You can remove any edges you want, but sum of edges removed must be minimum
a. Follow-Up: What if the tree is an n-ary tree
Given some chunks of files(1 to c), implement 3 functions:
→ join(user, vector<int> ownedchunks) - Give the smallest missing positive number as user_ld to the user and store the given chunks under this user and return user_Id.
→ leave(user_Id) - Remove this user by removing user_Id and freeing up the chunks under him.
→ request(user_Id, chunkid) - Return a vector of userld's who own the given chunkid.
There was a question of bank with n customers and they can withdraw or deposit money. Once they start to serve the customer they will stop untill the money left in the bank is less than the withdrawal amount. Find max no of customer bank can serve. Initially bank has some X dollars.
Design a stack with operations push, pop, add where add adds the input number n to the top k elements of the stack.
Given a list of documents and a list of queries, a list of corrupt queries, find the number of documents that are corrupt. A document which has a corrupt query run on it is corrupt and all the queries of a corrupt document are considered corrupt
Given a field in the form of a grid of side $n\times n.$ fill the square with given crops where the count of each crop is given and they all sum up to $n^{\wedge}2$ 2.It's like suppose four types of crops are given, then the crops of same type have to be beside each other in a 2d array.Idaithe oka type of crops anni DFS chesthe vacheseyali atlaa fill cheyali ante immediate right left down top lo ekadaina undali.
Window is given of k element. Find the avg of k elements while removing n largest element from that window. (ambigous)
There is an array of Os and 1s. There is an API called query that returns true if there is a 1 in A[L, R and false otherwise. Given the size of the array, write a function that returns the position of all 1s.
given ar[] -> values of balls(can be -ve,+ve, 0). 2 players -> each Player can pick either 1 or 2 balls at once. Both players play optimally, value of balls picked gets added to the score of players, We have to make sure that player 1 wins and return max difference of (score of player1 - player2)
given a graph, each node contains pair{row,col}. matrix[m][n] -> contains houses(at pair{row,col}) and empty blocks, each house owner wants to plant in exactly one of the 4 neighbouring empty blocks, but there must be atmost 1 plant in each row and each col, return matrix after planting.
We are given a list of points in the plane. Write a function to return the area of the largest rectangle formed by any four points in the list.
Given an array A, a starting position S, as well as offset integer X. Return the final position of a jumping game which has the following rules:
➤ For every odd jump you have to jump left from current position (C) to the closest position CL, such that $A[CL]=A[C]+1$ For every even jump you have to jump right from the current position (C) to the closest position CR, such that $A[CR]=$
$A[C]+1.$
➤ If there is no valid position for next jump then stop jumping and return position C.
➤ For every successful jump, the array value at the position before jump (C) should
be incremented by X. $A[C]+=X$, then proceed to the next round at the new position.
a. Write a function which returns the position where you end after performing all suitable jumps.
b. Follow-Up: Discuss the edge cases, where there is a possibility of infinite loop- When does it occur and how will you tackle it?
There are sellers selling a product named "ABC". Every seller has their own price to sell this product for. You have to arrange the sellers in the order_book based on the ascending order of the price and if the price is the same then based on the timestamp in which they have arrived to this order_book.
→ Input: seller_id(which is unique), price and timestamp → Complete the below two functions:
insert(seller_id,price, timestamp) -> Inserts the sellers into order_book based on the above mentioned order
get_the_seller() -> Returns the seller_id with least price and removes the seller from the order_book
a. Follow-Up-1: What if the sellers get anxious and leave the order_book? How would you handle this?
b. If the price range is given for suppose 1 to 10000, and timestamps will be in ascending order, how would you optimise the above 2 functions?
Implement a class called Superstack that implements the stack interface: push(k), peek(), pop().Additionally the stack should implement the function sum()--> which returns The total sum of stack and inc(n,k)--> increment the bottom n elements by k.
Imagine we are on a parking garage. All day, car enters and exit. When a car enters it takes a ticket and when exits it returns the ticket. The machine prints the entry and exit on each ticket. At the end of the we have got a pile of tickets and we want to figure out how Many cars were there in the garage at each time of the day.
Given a grid which consists of only one exit and many walls and robots at each of the cell. Here #-->represents the wall and .--> represents the robot and E is the exit. At each cell which has robot return the direction (U/D/L/R) such that when robot follows the direction from each cell it should eventually reach the exit. (If the direction is down and it has a wall (#) at that place then it will remain in the same position). Robot can be anywhere on the dot in the grid.
Input:
######
#.#E.#
#....#
######
Follow UP- Return the set of commands such that if any robot follows the commands then it should pass the exit.
ex-UDULRDUL it is a command such that if we follow this every dot much pass the exit.
Wordle is a game where a player tries to guess a secret 5 letter word from the english dictionary.Every time the player guesses they get a clue. Our task is to create a wordle finder which helps the player by providing guesses for the secret word, given the last guess made by the player. Given access to the entire English dictionary of 5 letter word and these three letter 5-letter string inputs, generated from the players last guess.
Green: (G) letters mean that letter is both correct and in the right position
Yellow: (Y) letters means letter is in the word, but not at the right position
Red: (R) letters means the secret word does not contain the letter with an exception: If a guess contains a letter thats in the secret word and the guess has multiple instances of that letter, then the letter could appear in both Green/Yellow and Red.
Consider the case when the secret word is PLANE contains P and the guess APPLE contains the 2Ps. The first P is scored as Yellow while the second P as Red. Output the possible guesses for the secret word.
get_hints(green="PR_ _ _", yellow="_ _ M _ _", red = "_ _ _ ZF") →
[PRAMS, PRIME, PRIMI, PRIMO, PRIMP, PRIMS, PRISM, PROEM, PROMO, PROMS]
Each poem has a Rhyme Scheme. Where the last words of each line are-
Specialiazation (A)
Location (A)
Compile (B)
Trial (B)
Immolation (A)
3line poem-AAA, AAB, ABB, ABA, ABC.
Write a function which takes a short rhyme scheme and a long rhyme scheme and if possible extends the short one to match with the long one
EX-DEE ABBBA -> DEEED
Allocate books question in binary search but here it is double instead of int.
The member of states of UN are planning to send 2 people to the moon. Theuy want to be from the different countries. You will be given a list of pairs of astronauts IDs. Each pair is made of astronauts of same country. Determine how many pairs of astronauts from different countries they can choose from.
$n=4$ astronaut= \[1,2], \[2,3] ->3 pairs from \[0,1], \[0,2] and \[0,3]
partition the array into two parts such that sum is equal and if needed you can also remove the elements.
Follow up- take that array now as circular. (Given a necklace with beats remove any beats such that two arrays sum is equal)
Given an array of positive and negative numbers. Find the max length of the window such that sum is $>=0$
longest increasing subsequence with difference k.
Given a stream of numbers. Find the median of them.
Given different trains with starting station, destination station, arrival time and destination time.Is it possible to reach from starting station to ending station or not??
Given two arrays A and B. IF you shuffle the entries in A then B is possible. Do the similar shuffle as of A in array C and find the corresponding B.
Given a compressed string, transform that into its decompressed form $a(b{3}c){2}f\rightarrow abbcabbcf$
Follow up- Given decompressed find its compressed form.
You should simplify an algebraic equation given like string $Ex: (a-b)+(b-c)=a-c$
Given cities in which some cities has data centres. Now you have to put a new data centre in a city such that min distance from this city to city which already has a data centre has to be maximised.
Given some free seats and occupied seats, return the longest free seats sequence.
Given a sequence of numbers, return the longest sequence in which all are consecutive numbers.
Follow up- Longest subsequence with difference atmost d
All possible sequences of 1s and 2s that summed upto n.
A class was given with a dictionary passing in its constructor
It has a method that tells the hash value for each of the word in the dictionary And another method is the one that i wrote calculating the score
Now i had to implement another method that returns the max score anagram for each of the word.I needed to implement a function first that calculates the score of a string The score is the total distance between each letter.
An acyclic graph was given, with utmost 3 neighbours and we have to find the vertex in the graph which can be the potential root of a binary tree.
What will you do if your colleague takes credit for your work?
What are your short-term and long-term goals?
What will you do if you get into some clashes with your teammates?
What was a tough thing you tackled in your internship and how did you do it?
What was your greatest achievement in recent times?
What would you do if you have problems with your colleague, if he is not cooperative?
What will you do if you are not comfortable with the team, tech-stacks, etc. How would you change yourself or the situation?
Describe a time when you had different opinion with your teammate. How did your team conclude the decision and how did you discuss different opinions and come up with the final decision?
How will you handle hectic deadlines?