Add office photos
Employer?
Claim Account for FREE

Goldman Sachs

3.5
based on 1.2k Reviews
Filter interviews by

300+ APOLLO POWER SYSTEMS Interview Questions and Answers

Updated 31 Jan 2025
Popular Designations

Q1. Ninja and the Game of Words

In this game, Ninja is provided with a string STR that might contain spaces, and a list or array WORDS consisting of N word strings. Ninja's task is to determine how many times each ...read more

Add your answer

Q2. Wildcard Pattern Matching Problem Statement

Implement a wildcard pattern matching algorithm to determine if a given wildcard pattern matches a text string completely.

The wildcard pattern may include the charac...read more

Add your answer

Q3. Digits Decoding Problem

Ninja has a string of characters from 'A' to 'Z', encoded using their numeric values (A=1, B=2, ..., Z=26). The encoded string is given as a sequence of digits (SEQ). The task is to dete...read more

Add your answer

Q4. Good old standard problem: Playing number game with your friend to select any of the number between 1 to 3. Whoever reaches 20 first, wins. You have to tell the strategy to win the game. Basically, you start wi...

read more
Ans.

The strategy is to always subtract the number chosen by the friend from 4 to ensure reaching 16 first.

  • Start with 20 and subtract the number chosen by the friend from 4.

  • Continue this strategy until reaching 16 before the friend reaches 17-19.

  • Ensure the friend ends up at any number between 17 to 19 before reaching 16.

Add your answer
Discover APOLLO POWER SYSTEMS interview dos and don'ts from real experiences

Q5. Chocolate Distribution Problem

You are given an array/list CHOCOLATES of size 'N', where each element represents the number of chocolates in a packet. Your task is to distribute these chocolates among 'M' stude...read more

Add your answer

Q6. Gold Mine Problem Statement

You are provided with a gold mine, represented as a 2-dimensional matrix of size N x M with N rows and M columns. Each cell in this matrix contains a positive integer representing th...read more

Add your answer
Are these interview questions helpful?

Q7. Group Anagrams Together

Given an array/list of strings STR_LIST, group the anagrams together and return each group as a list of strings. Each group must contain strings that are anagrams of each other.

Example:...read more

Add your answer

Q8. Greatest Common Divisor Problem Statement

You are tasked with finding the greatest common divisor (GCD) of two given numbers 'X' and 'Y'. The GCD is defined as the largest integer that divides both of the given...read more

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. Given a tank with liquid, and there are flows in and out, inflow is U and outflow is Kx, where x is current height of liquid in tank, all needed quantities given, what are the conditions for overflow and steady...

read more
Ans.

Conditions for overflow and steady state in a tank with inflow and outflow

  • Overflow occurs when the inflow rate is greater than the outflow rate

  • Steady state is achieved when the inflow rate equals the outflow rate

  • Overflow can be prevented by adjusting the inflow rate or increasing the outflow rate

  • Steady state can be maintained by balancing the inflow and outflow rates

Add your answer

Q10. Boyer Moore Algorithm for Pattern Searching

You are given a string text and a string pattern. Your task is to find all occurrences of pattern in the string text and return an array of indexes of all those occur...read more

Add your answer

Q11. Circular Tour Problem Statement

Consider a circular path with N petrol pumps. Each pump is numbered from 0 to N-1. Every petrol pump provides:

  1. The amount of petrol available at the pump.
  2. The distance to the ne...read more
Add your answer

Q12. Given we have a (un)biased die, with given probabilities, and we toss it till we get a sum of 100 or more (basically if the sum crosses 100), and we stop. What is the most probable number you will get on the la...

read more
Ans.

The most probable number on the last toss is 6.

  • The probability of getting a sum of 100 or more is highest when the sum is 99.

  • The last toss will be made to reach the sum of 100, so the most probable number is the one that will take the sum closest to 100.

  • The sum of 94 can be achieved by rolling a 6 on the last toss, which is the most probable number.

Add your answer

Q13. LRU Cache Design Question

Design a data structure for a Least Recently Used (LRU) cache that supports the following operations:

1. get(key) - Return the value of the key if it exists in the cache; otherwise, re...read more

Add your answer

Q14. Shortest Path in a Binary Matrix Problem Statement

Given a binary matrix of size N * M where each element is either 0 or 1, find the shortest path from a source cell to a destination cell, consisting only of 1s...read more

Add your answer

Q15. Suppose a man starts at 0, and has to go to 20 on the number line. He can either move in steps of 1 or 2. How many number of ways can he do this? Extending this, if we know the number of ways for going from 0 t...

read more
Ans.

Count number of ways to reach 20 on number line starting from 0 in steps of 1 or 2. Derive recursive formula for n+1.

  • Use dynamic programming to count number of ways for each step.

  • For each step, number of ways is sum of number of ways for previous 1 or 2 steps.

  • Recursive formula: ways[n+1] = ways[n] + ways[n-1]

Add your answer

Q16. Replace Node With Depth Problem Statement

For a given Binary Tree of integers, replace each of its data with the depth of the tree. The root is at depth 0, hence the root data is updated with 0. Replicate the s...read more

Add your answer

Q17. If you are asked to play a game where you toss a fair coin again and again until you get consecutive heads and win Re. 1 or you get consecutive tails and lose and quit, how much will you be willing to pay to pl...

read more
Ans.

I would be willing to pay 50 paise to play this game.

  • The expected value of the game is 50 paise.

  • This is because the probability of getting consecutive heads is 1/3 and the probability of getting consecutive tails is 1/4.

  • Therefore, the expected value of the game is (1/3 * 1) - (1/4 * 1) = 1/12 = 8.33 paise.

  • However, since the minimum amount that can be won is Re. 1, I would be willing to pay 50 paise to play the game.

Add your answer

Q18. There is an urn with n red balls and 1 black ball in it. You and your friend play a game where you take turns drawing from the urn. The player who draws the black ball first wins. Should you go first or second?

Ans.

Go second. The probability of winning is higher when going second.

  • The probability of winning when going first is (1/n+1), while the probability of winning when going second is (n/n+1)

  • This is because the first player has a chance of drawing the black ball on their turn, while the second player has a chance of drawing the black ball on their turn or the first player's turn

  • For example, if there are 10 red balls and 1 black ball, the probability of winning when going first is 1/1...read more

Add your answer

Q19. Suppose there are N chocolates, and I pick a random one, and eat that chocolate and also everything to the right of it. I then continue this process with the remaining. How many ways are there to do this?

Ans.

There are (N-1)! ways to eat chocolates from left to right.

  • The first chocolate can be chosen in N ways, the second in (N-1) ways, and so on.

  • However, since the order of chocolates eaten matters, we need to divide by the number of ways to order N chocolates, which is N!.

  • Therefore, the total number of ways to eat chocolates is (N-1)!

  • For example, if N=4, there are 3! = 6 ways to eat the chocolates.

Add your answer

Q20. Given 3 functions, f which gives the first day of the current month, g gives the next working day and h gives the previous working day, conpute the 3rd working day? Compute the 2nd working day of the previous m...

read more
Ans.

Compute working days using given functions f, g, and h.

  • To compute the 3rd working day, apply function g three times to function f.

  • To compute the 2nd working day of the previous month, apply function h to function f, then apply function g twice.

  • To compute the 4th working day of the next month, apply function g four times to function f.

Add your answer

Q21. An IT sector multinational wants to expand its business into more countries. Suggest a strategy. This was the question given in the VC round by the Partner. It was followed by a lot of numerical and qualitative...

read more
Ans.

To expand into more countries, the IT sector multinational can adopt a market entry strategy that includes market research, partnerships, localization, and scalability.

  • Conduct thorough market research to identify potential countries for expansion

  • Establish strategic partnerships with local companies to leverage their knowledge and networks

  • Adapt products and services to meet the specific needs and preferences of each target market

  • Ensure scalability of operations to handle the i...read more

Add your answer

Q22. Suppose you and I are playing a dice game. The one who get the lesser number looses the games. The dice has n sides. If I start the game, what is the probablity of you winning?

Ans.

Probability of winning a dice game where the one with lesser number wins.

  • The probability of winning depends on the number of sides on the dice.

  • If the dice has an odd number of sides, the probability of winning is higher for the second player.

  • If the dice has an even number of sides, the probability of winning is equal for both players.

Add your answer

Q23. There is a 2D plane with infinite parallel, vertical lines with a spacing of 1 unit between them. You drop a rod of length L randomly on the plane, with random position and orientation. What is the probability...

read more
Ans.

Probability of a randomly dropped rod of length L intersecting a line on a 2D plane with infinite parallel, vertical lines.

  • The probability depends on the length of the rod L.

  • The probability can be calculated using geometric probability.

  • The probability is 1 - (2L - 1) / infinity.

  • For example, if L = 1, the probability is 0.5.

  • If L = 2, the probability is 0.75.

Add your answer

Q24. Given a biased coin, how do you create an unbiased toss?

Ans.

Flip the coin twice and consider the outcome as follows.

  • Flip the coin twice and consider the outcome as follows:

  • - If both flips are heads or both are tails, discard and flip again.

  • - If the first flip is heads and the second is tails, consider it as heads.

  • - If the first flip is tails and the second is heads, consider it as tails.

  • This method ensures a 50-50 chance of getting either heads or tails.

  • Alternatively, use a physical method to balance the weight distribution of the coi...read more

View 1 answer

Q25. Given a number line, and we have a rod of length L. We drop the rod on the line, what is the probability that it covers an integer?

Ans.

Probability of a rod of length L covering an integer on a number line.

  • The probability depends on the length of the rod and the distance between adjacent integers on the number line.

  • If the length of the rod is less than the distance between adjacent integers, the probability is zero.

  • If the length of the rod is greater than or equal to the distance between adjacent integers, the probability is (L - d)/d, where d is the distance between adjacent integers.

  • The probability can be c...read more

Add your answer

Q26. Find the Longest Palindromic Substring

Given a string ‘S’ composed of lowercase English letters, your task is to identify the longest palindromic substring within ‘S’.

If there are multiple longest palindromic ...read more

Add your answer

Q27. Supposed there is a party, with 9 people, each person wants to give gifts to 3 people and also wants a gift from them. Is this scenario possible? If not, when is this possible? Give me a general case

Ans.

No, it is not possible for each person to give gifts to 3 people and receive a gift from them in a party of 9 people.

  • In this scenario, each person would need to receive 3 gifts, which is not possible if there are only 9 people.

  • This scenario would be possible if there were at least 10 people at the party.

  • In general, for a party of n people, each person can give gifts to n-1 people and receive gifts from n-1 people.

Add your answer

Q28. Delete a Node from a Linked List

You are provided with a linked list of integers. Your task is to implement a function that deletes a node located at a specified position 'POS'.

Input:

The first line contains a...read more
Add your answer

Q29. Climbing the Leaderboard Problem Statement

In a game leaderboard, scores determine rankings where the highest score gets rank 1. Players with identical scores share the same rank, followed by the next rank down...read more

Add your answer

Q30. Design a HashSet

Create a HashSet data structure without using any built-in hash table libraries.

Functions Description:

1) Constructor: Initializes the data members as required. 2) add(value): Inserts an eleme...read more
Add your answer

Q31. 1. What is the probability that a person starting at 1 and who takes single steps ahead/back with equal probabilities reach 0 before 100?

Ans.

The probability is 1/2.

  • The person can either move forward or backward with equal probabilities.

  • The probability of reaching 0 before 100 is 1/2.

  • This is a simple random walk problem.

Add your answer

Q32. You have an n x n matrix in which all the rows and all the columns are sorted. Given an input number, describe an algorithm to search for the number in the matrix

Ans.

Algorithm to search for a number in an n x n matrix with sorted rows and columns.

  • Start from the top-right corner of the matrix

  • If the current element is greater than the target, move left

  • If the current element is less than the target, move down

  • Repeat until the target is found or the bottom-left corner is reached

Add your answer

Q33. Counting Pairs Problem Statement

Given a positive integer N, determine the count of all possible positive integral pairs (X, Y) that satisfy the equation 1/X + 1/Y = 1/N.

Example:

Input:
T = 1
N = 2
Output:
3
Ex...read more
Add your answer

Q34. Fenwick Tree Problem Statement

You are provided with an array/list ARR consisting of 'N' integers, along with 'Q' queries. Each query can be of one of the following two types:

  • Type 1 (Range Sum): Given two int...read more
Add your answer

Q35. Ways To Make Coin Change

Given an infinite supply of coins of varying denominations, determine the total number of ways to make change for a specified value using these coins. If it's not possible to make the c...read more

Add your answer

Q36. Shortest Bridge Problem Statement

Two characters, Tony Stark and Thanos, reside on two separate islands within a 2-D binary matrix of dimensions N x M. Each matrix cell has a value of either 1 (land) or 0 (wate...read more

Add your answer

Q37. 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.

Add your answer

Q38. Is the price of a barrier option more or less than a normal option?

Ans.

The price of a barrier option is generally less than a normal option.

  • Barrier options have a condition that must be met for the option to be activated, which reduces the likelihood of the option being exercised.

  • This reduced likelihood of exercise means that barrier options are generally cheaper than normal options.

  • However, the price of a barrier option can vary depending on the specific conditions and terms of the option.

  • For example, a knock-in barrier option may be more expen...read more

Add your answer

Q39. Consecutive Sum Representation of a Number

Find the number of ways the given number 'N' can be expressed as the sum of two or more consecutive natural numbers.

Example:

Input:
N = 9
Output:
2
Explanation:

The n...read more

Add your answer

Q40. Zero Matrix Problem Statement

You are given a matrix MATRIX of dimension N x M. Your task is to make all the elements of row i and column j equal to 0 if any element in the ith row or jth column of the matrix i...read more

Ans.

The task is to modify a given matrix such that if any element in a row or column is 0, then make all elements in that row and column 0.

  • Iterate through the matrix and keep track of rows and columns that contain 0s

  • After the first iteration, iterate through the tracked rows and columns and set all elements to 0

  • Handle the case where the first row or column contains 0 separately

  • To solve with O(1) space complexity, use the first row and first column of the matrix to track the rows ...read more

Add your answer

Q41. Sudoku Solver Problem Statement

You are provided with a 9x9 2D integer matrix MAT representing a Sudoku puzzle. The empty cells in the Sudoku are denoted by zeros, while the other cells contain integers from 1 ...read more

Add your answer

Q42. Longest Palindromic Substring Problem Statement

You are provided with a string STR of length N. The goal is to identify the longest palindromic substring within this string. In cases where multiple palindromic ...read more

Add your answer

Q43. Largest Rectangle in Histogram Problem Statement

You are given an array/list HEIGHTS of length N, where each element represents the height of a histogram bar. The width of each bar is considered to be 1.

Your t...read more

Add your answer

Q44. Ninja and Typing: Comparison of Edited Strings

Ninja needs to compare two strings printed on a text editor, where only lowercase English letters and backspace (represented by ‘#’) are used for typing.

You need ...read more

Add your answer

Q45. You roll a die until the sum of all die rolls becomes at least 100. What is the most likely value of the last roll?

Ans.

What is the most likely value of the last roll in a game where a die is rolled until the sum of all rolls is at least 100?

  • The last roll must be at least 4 to reach a sum of 100

  • The probability of rolling a 4, 5, or 6 is 1/2

  • The most likely value of the last roll is 4 or 5

Add your answer

Q46. Given coordinates of some points, find a figure that encompasses all of the points. The figure should have the least possible area and be formed by joining points using straight lines. Convex Hull.

Ans.

The Convex Hull is the smallest convex polygon that encloses all given points.

  • Sort the points based on their x-coordinate.

  • Find the upper hull by starting from the leftmost point and moving clockwise.

  • Find the lower hull by starting from the rightmost point and moving counterclockwise.

  • Combine the upper and lower hulls to form the convex hull.

Add your answer

Q47. Print Nodes at Distance K from a Given Node

Given an arbitrary binary tree, a node of the tree, and an integer 'K', find all nodes that are at a distance K from the specified node, and return a list of these no...read more

Add your answer

Q48. Buy and Sell Stock Problem Statement

Imagine you are Harshad Mehta's friend, and you have been given the stock prices of a particular company for the next 'N' days. You can perform up to two buy-and-sell transa...read more

Add your answer

Q49. Similar Strings Problem Statement

Determine whether two given strings, A and B, both of length N, are similar by returning a 1 if they are, otherwise return a 0.

Explanation:

String A is similar to string B if ...read more

Ans.

The task is to determine if two strings are similar based on the given conditions.

  • Check if the strings are equal, if yes, return 1

  • Divide both strings into two parts and check if any combination satisfies the similarity condition

  • If none of the conditions hold true, return 0

Add your answer

Q50. If I have to buy fuel from you, what option would I buy?

Ans.

You can buy fuel from us through our fuel card program.

  • We offer a fuel card program that allows you to purchase fuel from our network of stations.

  • Our fuel card program offers discounts and rewards for frequent users.

  • You can easily track your fuel expenses and usage through our online portal.

  • We also offer customized fuel solutions for businesses and fleets.

  • Our fuel is high-quality and meets all industry standards.

Add your answer

Q51. If we increase the volatility of the stock, how does the price of a call option change?

Ans.

Increasing stock volatility increases the price of a call option.

  • Higher volatility means higher potential for the stock to move in the option holder's favor, increasing the option's value

  • The option's delta and gamma will also increase with higher volatility

  • Example: If a call option on a stock with a strike price of $50 has a premium of $2 when the stock has a volatility of 20%, increasing the volatility to 30% may increase the premium to $2.50 or higher

Add your answer

Q52. Maximum of All Subarrays of Size K

Given an array of non-negative integers and an integer K representing the length of a subarray, your task is to determine the maximum elements for each subarray of size K.

Exa...read more

Add your answer

Q53. Flatten the Multi-Level Linked List Problem

You are provided with a multi-level linked list consisting of 'N' nodes. Each node contains a 'next' and 'child' pointer that may point to another node. Your task is ...read more

Add your answer

Q54. Beautiful City Problem Statement

Ninja plans to visit a city where each house is connected via roads in a binary tree structure. Each level of the tree can have at most 2^K houses. Houses at the same level cann...read more

Add your answer

Q55. Find Pairs in a Doubly-Linked List

A sorted doubly-linked list of distinct positive integers is provided, along with an integer 'X'. Your task is to identify and print all unique pairs from the list whose sum e...read more

Add your answer

Q56. Count Pairs with Difference K

Given an array of integers and an integer K, determine and print the count of all pairs in the array that have an absolute difference of K.

Input:
The first line of the input conta...read more
Add your answer

Q57. Prime Numbers Identification

Given a positive integer N, your task is to identify all prime numbers less than or equal to N.

Explanation:

A prime number is a natural number greater than 1 that has no positive d...read more

Add your answer

Q58. Word Search Problem Statement

Given a two-dimensional grid of size N x M consisting of upper case characters and a string 'WORD', determine how many times the 'WORD' appears in the grid.

The 'WORD' can be forme...read more

Add your answer

Q59. Maximum Subarray Sum Problem Statement

Given an array arr of length N consisting of integers, find the sum of the subarray (including empty subarray) with the maximum sum among all subarrays.

Explanation:

A sub...read more

Add your answer

Q60. Maximize Matrix Binary Score

You are provided with a 2-D matrix called MAT consisting solely of 0s and 1s. Each row of the matrix can be viewed as a binary number, and the aggregate sum of these binary numbers ...read more

Add your answer

Q61. Cousin Nodes in a Binary Tree

Determine if two nodes in a binary tree are cousins. Nodes are considered cousins if they are at the same level and have different parents.

Explanation:

In a binary tree, each node...read more

Add your answer

Q62. Minimum Depth of a Binary Tree Problem Statement

Given a Binary Tree of integers, determine the minimum depth of the Binary Tree. The minimum depth is defined as the number of nodes present along the shortest p...read more

Add your answer

Q63. Merge Overlapping Intervals Problem Statement

Given a specified number of intervals, where each interval is represented by two integers denoting its boundaries, the task is to merge all overlapping intervals an...read more

Add your answer

Q64. Maximum Value of an Equation Problem Statement

Given an array/list of integers points containing coordinates (x, y) of N points in a 2D plane, sorted by x-values in non-decreasing order. You need to determine t...read more

Add your answer

Q65. The Celebrity Problem

Imagine there are 'N' people at a party, each assigned a unique ID from 0 to N-1. A celebrity at the party is a person who is known by everyone but knows no one else.

Problem Statement:

Yo...read more

Add your answer

Q66. First and Last Position of an Element in a Sorted Array

Given a sorted array/list ARR consisting of ‘N’ elements, and an integer ‘K’, your task is to find the first and last occurrence of ‘K’ in ARR.

Explanatio...read more

Add your answer

Q67. Partition Set Into Two Subsets With Minimum Difference

Given an array of N non-negative integers, split the array into two subsets such that the absolute difference between their sums is minimized.

The task is ...read more

Add your answer

Q68. Minimum Umbrellas Problem

You are provided with ‘N’ types of umbrellas, where each umbrella type can shelter a certain number of people. Given an array UMBRELLA that indicates the number of people each umbrella...read more

Add your answer

Q69. Given 10 balls which weigh the same, except for one, and a beam balance, what is the minimum number of weighs to find the odd ball?

Ans.

The minimum number of weighs to find the odd ball is 4.

  • Divide the 10 balls into 3 groups of 3, 3, and 4.

  • Compare the weights of the two groups of 3 balls.

  • If the weights are equal, the odd ball is in the group of 4.

  • If the weights are unequal, the odd ball is in the lighter group of 3.

  • Divide the lighter group of 3 balls into individual balls and compare their weights.

  • The odd ball will be identified in the 4th weigh.

View 2 more answers

Q70. LRU Cache Design Problem Statement

Design and implement a data structure for a Least Recently Used (LRU) cache that supports the following operations:

  • get(key) - Retrieve the value associated with the specifie...read more
Add your answer

Q71. Find the magic number in an sorted array. magic number is the one whose value and index position is same

Ans.

Find the magic number in a sorted array where value and index are same.

  • Iterate through the array and check if the value and index are same

  • If found, return the value

  • If not found, return -1

Add your answer

Q72. Clarification about what CPI stands(Is it the same as Grade Point Average?)

Ans.

CPI stands for Consumer Price Index, not the same as Grade Point Average (GPA).

  • CPI is a measure of the average change over time in the prices paid by urban consumers for a market basket of consumer goods and services.

  • It is used to track inflation and price changes in the economy.

  • GPA, on the other hand, is a measure of academic performance and represents a student's average grade point across courses.

  • CPI and GPA are completely different concepts and have no relation to each ot...read more

Add your answer

Q73. Regular Expression Match Problem Statement

Given a string str and a string pat, where str may contain wildcard characters '?' and '*'.

If a character is '?', it can be replaced with any single character. If a c...read more

Add your answer

Q74. Problem: Search In Rotated Sorted Array

Given a sorted array that has been rotated clockwise by an unknown amount, you need to answer Q queries. Each query is represented by an integer Q[i], and you must determ...read more

Add your answer

Q75. How many years will it take the Delhi Metro to break even?

Ans.

The Delhi Metro is expected to break even in 2025.

  • The Delhi Metro has been expanding rapidly and has seen a steady increase in ridership.

  • The metro has been able to generate revenue through advertising and property development.

  • The government has also provided financial support to the metro.

  • Based on current projections, the Delhi Metro is expected to break even in 2025.

View 1 answer

Q76. Serialization and Deserialization of an N-ary Tree

Given an N-ary tree where each node has at most 'N' child nodes, the task is to serialize the tree into a sequence of bits and then deserialize it back to reco...read more

Add your answer

Q77. Design a Constant Time Data Structure

Create a data structure that maintains mappings between keys and values, supporting the following operations in constant time:

1. INSERT(key, value): Add or update the inte...read more
Add your answer

Q78. Dice rolled several times until sum of outcomes till now comes greater than equal to hundred. What is most likely number to occur as final sum?

Ans.

The most likely number to occur as the final sum is 100.

  • The sum of the outcomes of the dice rolls will keep increasing until it reaches or exceeds 100.

  • Since the dice have equal probabilities for each outcome, the sum will have a higher chance of reaching 100.

  • The probability of rolling a sum greater than 100 decreases as the sum gets larger.

Add your answer

Q79. Find K-th Smallest Element in BST

Given a binary search tree (BST) and an integer K, the task is to find the K-th smallest element in the BST.

Example:

Input:
BST: Order of elements in increasing order is { 2, ...read more
Add your answer

Q80. Count Pairs with Given Sum

Given an integer array/list arr and an integer 'Sum', determine the total number of unique pairs in the array whose elements sum up to the given 'Sum'.

Input:

The first line contains ...read more
Add your answer

Q81. LCA in a Binary Search Tree

You are given a binary search tree (BST) containing N nodes. Additionally, you have references to two nodes, P and Q, within this BST.

Your task is to determine the Lowest Common Anc...read more

Add your answer

Q82. Why are gold prices increasing and why are US treasury bonds still valuable?

Ans.

Gold prices are increasing due to economic uncertainty and inflation concerns. US treasury bonds remain valuable due to their safe-haven status and reliable returns.

  • Gold prices are increasing due to economic uncertainty and inflation concerns.

  • Investors often turn to gold as a safe-haven asset during times of market volatility.

  • The demand for gold is also influenced by factors such as geopolitical tensions and central bank policies.

  • US treasury bonds are still valuable because t...read more

Add your answer

Q83. What is the expected number of tosses of a fair coin to get 3 consecutive heads?

Ans.

Expected number of tosses of a fair coin to get 3 consecutive heads.

  • The probability of getting 3 consecutive heads is 1/8

  • The expected number of tosses to get 3 consecutive heads is 14

  • This can be calculated using the formula E(X) = 2^k + 2^(k-1) + 2^(k-2) + ... + 2^2 + 2^1 + 2^0, where k is the number of consecutive heads required

Add your answer

Q84. Partition to K Equal Sum Subsets Problem

Given an array of integers and a positive integer 'K', determine if it is possible to divide the array into 'K' non-empty subsets such that the sum of elements in each s...read more

Add your answer

Q85. Pair Sum Problem Statement

You are provided with an array ARR consisting of N distinct integers in ascending order and an integer TARGET. Your objective is to count all the distinct pairs in ARR whose sum equal...read more

Add your answer

Q86. Reverse Linked List in Groups of K

You are provided with a linked list containing 'N' nodes and an integer 'K'. The task is to reverse the linked list in groups of size K, which means reversing the nodes in eac...read more

Add your answer

Q87. Rectangle Area Problem Statement

You are provided with a list of rectangles, each defined by an array of four integers: Rectangle[i] = [x1, y1, x2, y2]. Here, (x1, y1) represents the bottom-left corner, and (x2...read more

Add your answer

Q88. 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

Add your answer

Q89. Smallest Window Problem Statement

Given two strings S and X containing random characters, the task is to find the smallest substring in S which contains all the characters present in X.

Input:

The first line co...read more
Add your answer

Q90. Matrix Word Search Problem

Explanation: You are given an 'M' x 'N' matrix of characters named CHARACTER_MATRIX and a string WORD. Your task is to identify and list all the occurrences of the string within the m...read more

Add your answer

Q91. Convert a Number to Words

Given an integer number num, your task is to convert 'num' into its corresponding word representation.

Input:

The first line of input contains an integer ‘T’ denoting the number of tes...read more
Add your answer

Q92. Given an island in the center of a lake, and you are standing outside the lake, how would you reach the center?

Ans.

To reach the center of the island, one can use a boat or any other means to cross the lake.

  • Use a boat to reach the island

  • Swim across the lake if it's not too far

  • If the lake is frozen, walk or skate across the ice

  • If there is a bridge or causeway connecting the island, use it to reach the center

Add your answer

Q93. How many airplanes are flying in the Indian sky at the moment?

Ans.

The exact number of airplanes flying in the Indian sky at the moment is not available.

  • The number of airplanes flying in the Indian sky changes constantly.

  • It depends on factors such as time of day, weather conditions, and airline schedules.

  • However, on average, there are around 2,000 flights in the Indian airspace at any given time.

  • This number includes both domestic and international flights.

  • The Indian aviation industry has been growing rapidly in recent years, with more and mo...read more

Add your answer

Q94. Simplify Directory Path Problem Statement

You are provided with a directory path in Unix-style notation, and your task is to simplify it according to given rules.

In a Unix-style file system:

  • A dot (.) refers ...read more
Add your answer

Q95. Candies Distribution Problem Statement

Prateek is a kindergarten teacher with a mission to distribute candies to students based on their performance. Each student must get at least one candy, and if two student...read more

Add your answer

Q96. Fastest Horse Problem Statement

Given ‘N’ horses running in separate lanes, each horse's finish time is provided in an array. You are tasked to process 'Q' queries. For each query, determine the time taken by t...read more

Add your answer

Q97. Middle of a Linked List

You are given the head node of a singly linked list. Your task is to return a pointer pointing to the middle of the linked list.

If there is an odd number of elements, return the middle ...read more

Add your answer

Q98. Maximize Stock Trading Profit

You are given an array prices, representing stock prices over N consecutive days. Your goal is to compute the maximum profit achievable by performing multiple transactions (i.e., b...read more

Add your answer

Q99. Cycle Detection in a Singly Linked List

Determine if a given singly linked list of integers forms a cycle or not.

A cycle in a linked list occurs when a node's next points back to a previous node in the list. T...read more

Add your answer

Q100. First Non-Repeating Character Problem Statement

You are given a string consisting of English alphabet characters. Your task is to identify and return the first character in the string that does not repeat. If e...read more

Add your answer
1
2
3
4

More about working at Goldman Sachs

HQ - New York, New York, United States (USA)
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at APOLLO POWER SYSTEMS

based on 221 interviews
Interview experience
4.2
Good
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Interview Questions from Similar Companies

4.1
 • 548 Interview Questions
3.9
 • 197 Interview Questions
4.0
 • 185 Interview Questions
3.8
 • 181 Interview Questions
3.9
 • 176 Interview Questions
3.4
 • 174 Interview Questions
View all
Top Goldman Sachs Interview Questions And Answers
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