Filter interviews by
Merge sort is a divide-and-conquer algorithm that sorts an array by recursively splitting and merging sorted subarrays.
Divide the array into two halves until each subarray has one element.
Merge the sorted subarrays back together in sorted order.
Time complexity is O(n log n), making it efficient for large datasets.
Example: Sorting [38, 27, 43, 3, 9, 82, 10] results in [3, 9, 10, 27, 38, 43, 82].
Binary Search is an efficient algorithm for finding an item from a sorted list of items.
Binary Search works on sorted arrays. Example: [1, 2, 3, 4, 5]
It repeatedly divides the search interval in half.
If the target value is less than the middle element, search the left half.
If the target value is greater, search the right half.
Time complexity is O(log n), making it faster than linear search.
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, an...
Calculate total area covered by overlapping rectangles given their coordinates.
Iterate through each rectangle and calculate its area
Check for overlaps between rectangles and calculate the overlapping area
Sum up the areas of all rectangles and subtract the total overlapping area to get the final result
Given a grid with 'M' rows and 'N' columns, determine the total number of unique rectangles that can be formed using the rows and columns of this grid.
The first line...
The total number of unique rectangles that can be formed in a grid with M rows and N columns.
The total number of unique rectangles can be calculated using the formula: (M * (M + 1) / 2) * (N * (N + 1) / 2)
Each rectangle can be formed by selecting two rows and two columns from the grid
For example, for a grid with 3 rows and 4 columns, the total number of unique rectangles is 60
What people are saying about Goldman Sachs
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....
Given a string, find and return the first non-repeating character. If none exists, return the first character of the string.
Create a dictionary to store the count of each character in the string.
Iterate through the string and populate the dictionary.
Iterate through the string again and return the first character with count 1.
If no such character exists, return the first character of the string.
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 i...
Reverse a linked list in groups of size K.
Iterate through the linked list in groups of size K
Reverse each group of nodes
Handle cases where the number of elements in the last group is less than K
Given an array of strings ARRSTR[]
of size N
, and a character C
, your task is to sort the ARRSTR[]
array according to a new alphabetical order that starts with the g...
Sort an array of strings based on a new alphabetical order starting with a given character.
Iterate through the array of strings and compare each string with the given character to determine the new order.
Use a custom comparator function to sort the strings based on the new alphabetical order.
Handle lowercase English alphabet characters and strings of varying lengths.
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 palindr...
Given a string, find the longest palindromic substring, prioritizing the one with the smallest start index.
Iterate through the string and expand around each character to find palindromes.
Keep track of the longest palindrome found and its starting index.
Return the longest palindromic substring with the smallest start index.
Given a specified number of intervals, where each interval is represented by two integers denoting its boundaries, the task is to merge all overlapping interva...
Merge overlapping intervals and return sorted list of merged intervals.
Identify overlapping intervals based on start and end times
Merge overlapping intervals to form new intervals
Sort the merged intervals in ascending order of start times
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 task is to find the total number of ways to make change for a specified value using given denominations.
Use dynamic programming to solve this problem efficiently.
Create a 2D array to store the number of ways to make change for each value up to the specified value.
Iterate through each denomination and update the array accordingly.
The final answer will be in the last cell of the array.
Example: For N=3, D=[1, 2, ...
Good problems related to array or string
I applied via LinkedIn and was interviewed before Dec 2023. There were 3 interview rounds.
Aptitude along with English and comprehensive questions
Three coding questions one easy one medium one hard
Merge sort is a divide-and-conquer algorithm that sorts an array by recursively splitting and merging sorted subarrays.
Divide the array into two halves until each subarray has one element.
Merge the sorted subarrays back together in sorted order.
Time complexity is O(n log n), making it efficient for large datasets.
Example: Sorting [38, 27, 43, 3, 9, 82, 10] results in [3, 9, 10, 27, 38, 43, 82].
I appeared for an interview in Apr 2021.
Round duration - 135 minutes
Round difficulty - Hard
The Technical Round was of 2 hours 15 minutes and was conducted on HackerRank. It comprised of 5 sections:
Programming – 30 minutes: 2 easy to medium level questions (1 of 20 marks other of 30).
Quantitative Aptitude – 25 minutes: 7 Math-related MCQs.
Computer Science – 20 minutes: 8 MCQs based on Computer Science subject topics like OOPs, OS, DBMS, DSA
Advanced Programming – 45 minutes: 1 question on advanced Data Structures (100 marks)
Tell me about Yourself – 15 minutes: 2 essay type questions
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
.
T = 1
N = 2
Count the number of positive integral pairs (X, Y) that satisfy the given equation.
Iterate through all possible values of X and calculate corresponding Y to check if the equation is satisfied.
Optimize the solution by considering the constraints and properties of the equation.
Handle special cases like when N is 1 or when X and Y are equal.
Use mathematical properties to reduce the number of calculations needed.
Consider e...
Given a binary tree of integers, return the level order traversal of the binary tree.
The first line contains an integer 'T', representing the number of te...
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 nu...
Given a binary matrix, maximize the score by toggling rows or columns to convert them to binary numbers and summing them up.
Iterate through each row and column to calculate the score of toggling that row or column
Keep track of the maximum score obtained by toggling rows or columns
Return the maximum score obtained
Round duration - 11 hours
Round difficulty - Easy
Finally, I was selected for the interview round which was conducted virtually over zoom.I had 4 rounds spanning over a period of almost 11 hours (10 AM- 9 PM) with breaks in between rounds, of course. As each of these rounds was an elimination round candidate had 1 to 4 rounds. In the end, we were 13 students left out of 65 students.
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....
Given a string with wildcard characters, determine if it can be transformed to match another string under given rules.
Iterate through both strings simultaneously, handling wildcard characters '?' and '*' accordingly.
Use dynamic programming to keep track of matching characters.
Handle '*' by considering all possibilities of matching sequences.
Return true if at the end both strings match, false otherwise.
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 take...
Given finish times of horses, find fastest horse in specified lane ranges for multiple queries.
Iterate through each query and find the minimum finish time within the specified range.
Use a loop to process each test case and query efficiently.
Ensure to handle edge cases like empty ranges or invalid inputs.
Optimize the solution to handle large input sizes efficiently.
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.
Tip 1 : Be thorough with data structures and algorithms. Avoid just switching between different coding platforms according to people's suggestion instead pick one and stick to it(Leetcode worked for me!).
Tip 2 : Do not miss out on core subjects (for GS ,OOPs and Operating systems especially).
Tip 3 : Keep giving mock interviews (take at least 2 -3 prior to real one) ,it helps a lot to prevent last-minute interview anxieties and makes you feel prepared and confident.
Tip 1 : Choose the right format, it should reflect professionalism.Goldman Sachs blog suggests to arrange your resume with your educational information at the top,followed by your grade-point average,professional experience, projects and any special interests and activities or achievements.
Tip 2 : If you do not have any prior experience, solidify your projects section(3-4 is a good number).Articulate your project description in a precise and crisp format.
Tip 3 : Come up with three reasons why you should be picked for the job in accordance with job's description —these will be some of the top traits you’ll want to emphasize in your resume.
Tip 4 : Go through company's career blogs ,might give you relevant insights on what it expects then align your presentation in accordance with in.(Link to GS blog on resume tips:https://www.goldmansachs.com/careers/blog/posts/resume-tips-from-goldman-sachs.html )
I appeared for an interview in Mar 2021.
Round duration - 90 minutes
Round difficulty - Medium
This test was conducted on the Hackerrank platform, it was divided into 6 sections which contained a total of 66 questions with an overall time limit of 90 minutes, There was video proctoring, and changing sections were allowed.
The sections were-
Numerical Computations — 8 questions
Numerical Reasoning -12 questions
Comprehension — 10 questions
Abstract Reasoning — 12 questions
Diagrammatic Reasoning — 12 questions
Logical Reasoning — 12 questions
Given an integer number num
, your task is to convert 'num' into its corresponding word representation.
The first line of input contains an integer ‘T’ denoting the number o...
Convert a given integer number into its corresponding word representation.
Implement a function that takes an integer as input and returns the word representation of the number in English lowercase letters.
Break down the number into its individual digits and convert each digit into its corresponding word form.
Handle special cases like numbers between 10 and 19, multiples of 10, and numbers with zeros in between.
Concaten...
Round duration - 45 Minutes
Round difficulty - Easy
The interview started at 12 in the noon.
The interviewer seemed very cheerful. He began by greeting and asked me for a quick introduction.
Then he talked about the various projects I have mentioned in my resume and what further improvements I was going to make in my projects. Further he started asking questions on fundamentals of Data Structures and Algorithms, few questions on operating syatem and gave a problem statement on DSA.
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...
Tip 1 : Be honest about your skills and work experiences,especially prepare a good answer for the question "Tell me about yourself"
Tip 2 : Take whatever guidance you can get from seniors, faculty and your mentors.
Tip 3 : work on dynamic projects
Tip:4 : Try to write good and effective answers for the paragraph-based questions in the technical round.
Tip:5 : At the end always ask questions to the interviewer which shows your passion and interest to work in the company
Tip:6 : Always do some background search on the company you are applying for.
Tip 1 : Being honest about your achievements and projects
Tip 2 : Do not mention unnecessary details, only relevant details and information about the post you are applying for must be mentioned in your resume.
Tip 3 : Mention your unique qulities.
Tip 4 : Include 5-10 skills in the resume, and do highlight your most important skills and achievements.
I appeared for an interview in Feb 2021.
Round duration - 90 minutes
Round difficulty - Hard
Timing was 10 AM. Environment was very well. Questions were well explained.
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 um...
Given 'N' types of umbrellas with different capacities, find the minimum number of umbrellas required to shelter exactly 'M' people.
Iterate through the umbrella capacities and try to cover 'M' people using the minimum number of umbrellas.
Sort the umbrella capacities in descending order to optimize the solution.
If it is not possible to cover 'M' people exactly, return -1.
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 s...
Tip 1 : Aptitude is must.
Tip 2 : Practice puzzle problems.
Tip 3 : Do atleast 2 projects.
Tip 1 : Keep it short.
Tip 2 : Have some projects on resume.
I appeared for an interview in Feb 2021.
Round duration - 90 minutes
Round difficulty - Hard
Timing was 10 AM. Environment was very well. Questions were well explained.
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 um...
Find the minimum number of swaps required to sort a given array of distinct elements in ascending order.
T (number of test cases)
For each test case:
N (siz...
Tip 1 : Aptitude is must.
Tip 2 : Practice puzzle problems.
Tip 3 : Do atleast 2 projects.
Tip 1 : Keep it short.
Tip 2 : Have some projects on resume.
I appeared for an interview in Jan 2021.
Round duration - 120 minutes
Round difficulty - Easy
This round was held in the evening at 6 o'clock on Hackerrank. It had coding questions: easy, medium, and hard level and MCQ's ( 1 minute for each MCQ). Negative marking was also there
Given a column title as it appears in an Excel sheet, return its corresponding column number.
"AB"
28
Column title "AB" co...
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 ran...
Implement a function to determine a player's leaderboard rank for each game score.
Iterate through the game scores and compare them with the leaderboard scores to determine the rank.
Handle cases where players have identical scores by assigning them the same rank.
Ensure the leaderboard scores are in descending order and game scores are in ascending order.
Return the ranks for each game score in an array.
Round duration - 30 minutes
Round difficulty - Easy
This was an interview round ( technical round) that was held on video-call and a coding platform was also shared. The interviewer was very friendly with me . She was praising me on every solution that I provided.
You are given a multi-level linked list of N nodes, where each node can have two pointers: next and child. Flatten this multi-level linked list into a singly linked lis...
Flatten a multi-level linked list into a singly linked list and return the head of the flattened list.
Traverse the linked list in level order
Use a stack to keep track of nodes with child pointers
Merge the child nodes into the main list
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.
Round duration - 35 minutes
Round difficulty - Easy
This was an interview round ( technical round) that was held on video-call and a coding platform was also shared. The interviewer was very friendly with me . She was praising me on every solution that I provided.
Create a HashSet data structure without using any built-in hash table libraries.
1) Constructor: Initializes the data members as required.
2) add(value): Inserts...
Design a HashSet data structure with add, contains, and remove functions.
Implement a HashSet using an array of linked lists to handle collisions.
Use a hash function to determine the index in the array for each element.
For add function, check if the element already exists before inserting.
For contains function, search for the element in the corresponding linked list.
For remove function, find and remove the element from ...
Round duration - 20 minutes
Round difficulty - Easy
Online HR+Technical Round .
Tip 1 : Practice DP based questions as much as you can. Also, be confident during the interview about your solution. For practice, you can prefer Coding Ninjas and Geeks For Geeks.
Tip 2 : They do not judge you upon the number of internships you have done or the number of projects you have made. A single ,good-quality project is sufficient, provided you have in-depth knowledge about it. What matters to them is how efficient learner you are, how good is your problem-solving skill and also how confident you are with your answers.
Tip 3 : Practice topic -wise questions, participate in lots of coding contests, watch lots of Youtube solutions even after you could solve a question, because you may find a different approach that is efficient than yours and watching video solutions is always a better option than just reading the solution , as it gives a clear and deeper understanding of the logic's . Also pray hard along with your preparation.
Tip 1 : Keep it short. Mention the academic and professional projects you've done. Add your educational details properly with percentage or CGPA obtained.
Tip 2 : Keep your resume short and clear. Mention your projects and internships with a brief description and year of completion. Mention coding languages are known to you, or other technical skills that you are good at. Do not mention anything that you are not good at. Highlight the topics that you are really good at.
Tip 3 : Be very honest and figure out only those things in your resume that you really know. Anything extra or unknown may have a negative impact upon your interview if asked by the interviewer.
I appeared for an interview in Feb 2021.
Round duration - 90 minutes
Round difficulty - Medium
It was on done in hackerrank
Given a matrix ARR
of dimensions N * M
, your task is to determine the rank of the matrix ARR
.
The rank of a matrix is defined as:
(a) The maximum number of linearly...
Calculate the rank of a matrix based on the number of linearly independent column or row vectors.
Determine the rank of the matrix by finding the maximum number of linearly independent column vectors or row vectors.
Check for linear independence by verifying if there is a nontrivial linear combination that equates to the zero vector.
Implement a function that takes the matrix dimensions and elements as input and returns t...
Determine how many triangles exist in an undirected graph. A triangle is defined as a cyclic path of length three that begins and ends at the same vertex.
Count the number of triangles in an undirected graph using adjacency matrix.
Iterate through all possible triplets of vertices to check for triangles.
For each triplet, check if there are edges between all three vertices.
Increment the count if a triangle is found.
Return the total count of triangles for each test case.
Round duration - 20 minutes
Round difficulty - Medium
Interviewer was quite friendly
Tip 1 : start from scratch
Tip 2 : practice as much as u can
Tip 1 : some students add fake internships to their resume dont do it.
Tip 2 : Don't Put Everything on There. Your resume should not have every work experience you've ever had listed on it.
I appeared for an interview in Nov 2020.
Round duration - 120 minutes
Round difficulty - Medium
A 120-minute online test was conducted on HackerRank which had the following format:
1st Section :
2 Coding questions(30 minutes)
2nd Section :
10 MCQ questions(30 minutes)
3rd Section :
1 Advanced Programming Question(45 minutes)
4th Section :
2 Subjective Questions(15 minutes)
The coding questions and MCQ questions were a bit tricky so you need to manage your time properly and try to solve all the questions correctly..
Technical – included c and c++ output question, os(scheduling, semaphore), dbms(normal form, etc).
Find the number of ways the given number 'N' can be expressed as the sum of two or more consecutive natural numbers.
N = 9
2
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'.
The first line c...
Round duration - 45 minutes
Round difficulty - Medium
interview started with a typical tell me about yourself question. The interviewer was nice and friendly.
He asked me to explain a little about my projects (only basics).
Which all data structures you know and my favourite data structure. I replied with a linked list.
He asked the difference between array and linked list, time complexities of insertion, deletion, etc. in both of them. Then he asked about sorting an array, different algorithms, and their time complexities.
How would you sort a linked list? How would you find the middle of the linked list in one pass? How would you merge two linked lists (I had to write code for the same)?
Then he asked how would you be able to manage the business and finance decisions at GS.
Tell me an incident when you had the chance to display your leadership skills.
Lastly, I was allowed to ask questions from the interviewer.
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.
In a binary tree, e...
Determine if two nodes in a binary tree are cousins based on level and parent criteria.
Traverse the tree to find the levels and parents of the given nodes.
Check if the nodes are at the same level and have different parents.
Return 'YES' if the nodes are cousins, 'NO' otherwise.
Round duration - 45 minutes
Round difficulty - Medium
This round was relatively short and mostly consisted of coding (on hackerrank’s codepair platform)
The interviewer asked me about my previous interview and what all questions were asked in it.
Then there was a discussion about my projects and the technologies used in them. How would you deploy an application and what happens in the process of entering a keyword in the browser and loading your requested page?
He asked me to write the code for finding the middle of a linked list in one pass.
After that, I had to write the code for the implementation of a queue. I first discussed the approaches with him using array and linked lists for some time. They wrote the code using a linked list by taking head and tail pointer.
He was satisfied with it and the round ended with me asking him the questions I had.
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 ...
Tip 1 : Revise all the coding interview questions that you have solved so far in the last few days
Tip 2 : Practice writing the codes on paper with clarity
Tip 3 : Mention only those thing that you know in your CV and revise your projects nd everything you have mentioned on your resume thoroughly.
Tip 1 : Do not even mention topics you have no idea about
Tip 2 : you should have some projects on resume and you should be able to explain clearly why you have chosen the particular project, what does it do, its functionality, outcomes and everything about each of the projects.
Tip 3 : Tailor your resume according to the needs/the role you are applying for
I appeared for an interview in Oct 2020.
Round duration - 135 minutes
Round difficulty - Hard
(Online Assessment Test): Platform was HackerRank with tab proctoring and webcam proctoring enabled. This round consisted of 5 sections(There was a section-wise time limit)
Section 1:
=> 2 coding questions of moderate level (Time: 30 Minutes)
=> 5 languages allowed: CPP, java, java8, python, python3
Section 2: (Maths and Quant):
=> Marking: +5,-2
=> Time: 25 min
=> 8 MCQs
=> Questions on probability, combinatorics, binomial theorem, etc.
Section 3: (CS MCQs):
=> Marking:+5,-2
=> Time: 20 min
=> 7 MCQs
=> Based on topics like Data structures, Algorithms, OS, Networking, etc.
Section 4:
=> The Advanced Programming Section had 1 programming question.
=>Time: 45 mins.
Section 5:
=> 2 value-based type questions each having 10 marks(to be answered in brief)
=> Time: 15 min
The questions of section 5 were as follows:
1. Suppose you and your friend are doing an important project having some deadline. Then suddenly your friend left the project in the middle because of some unavoidable reasons. What will you do in that situation?
2. Mention one instance where you were highly motivated and excited for a project and you achieved exceptional results in it.
Shortlist Criteria, GS follow GPA+TEST Score. 54 students were shortlisted for the next Rounds.
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.
Given a specified number of intervals, where each interval is represented by two integers denoting its boundaries, the task is to merge all overlapping interv...
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 palind...
Round duration - 60 minutes
Round difficulty - Medium
The platform was Zoom for video calls and HackerRank CodePair for coding.
This round began with a formal introduction, followed by a few questions related to the work I have done as Technical Head in the Placement Cell during Under Graduation. Then, he asked me how much I rate myself in problem-solving and coding skills and justify why I think so.
Then, he asked to write code for the problem:
Sort the array of strings according to the new alphabetical order. New alphabetical order starts with a given character ‘c’.
After that, he asked me If I had any questions to ask.
This round went very well, and I was selected for the next round.
Given an array of strings ARRSTR[]
of size N
, and a character C
, your task is to sort the ARRSTR[]
array according to a new alphabetical order that starts with the ...
Round duration - 60 minutes
Round difficulty - Medium
The Interviewer had my CV this time. He started by asking me about the experience of the previous Interview round.
He then asked me to introduce myself and asked me to tell more about my strengths, language preferences, and technical skills.
Then for the next 20-25 minutes, he asked questions related to the project I mentioned. He particularly asked me to explain in detail the part of the project that my other teammate did. He also asked questions like what I learned from this, what was the motive behind this etc…
Since I mentioned in my introduction that I had an interest in the Data Science Field, he asked a few questions related to data mining, data pre-processing, machine learning algorithms, libraries used for the same, etc.
Tip 1 : Do not panic and Remain calm. Be Honest(in both Resume and during the Interview).
Tip 2 : Listen to the PPTs of the companies properly.
Tip 3 : While you are solving a question, speak to the interviewer.
Tip 4 : Data Structures, Problem Solving is very important. Good CGPA helps, personal projects, extracurricular activities would also give you an edge.
Tip 1 : Have some good projects on your resume and study those.
Tip 2 : Don't lie on your resume, as they are very much experienced.
based on 2 interview experiences
Difficulty level
Duration
Associate
2.5k
salaries
| ₹19.1 L/yr - ₹35 L/yr |
Analyst
2k
salaries
| ₹11.6 L/yr - ₹21.6 L/yr |
Vice President
1.9k
salaries
| ₹36.2 L/yr - ₹60 L/yr |
Senior Analyst
1.2k
salaries
| ₹8.9 L/yr - ₹15 L/yr |
Senior Associate
448
salaries
| ₹15 L/yr - ₹27 L/yr |
JPMorgan Chase & Co.
Morgan Stanley
TCS
Amazon