Hackerrank Test (90 Minutes):
They had eligibility criteria of 8 pointers. There were 2 coding questions (15 + 35 Marks) and 5 Computer Science questions (50 Marks). 10 out of 200 students were shortlisted for Interviews.
1) You are given an array of integers. You have to find total number triplets possible in it such that sum of the 3 elements is 0. (After telling the logic, she asked me to write code for it on paper)
2) You are given a java class Employee with members such as firstName, lastName, and city. There are n objects instantiated of the class. How will you sort these objects by firstName? How will you sort these objects by any member of the class? Write a dynamic method for that.
3) An easy aptitude question based on simple math.
4) Any questions?
1) Tell me about yourself. (I went on explaining about my life journey :P, he kept driving the conversation by asking more questions)
2) Why do you want to join Goldman Sachs?
3) What are your favorite subjects/topics, what are your interests?
4) Tell me about the last code you wrote that you’re proud of. What was the time complexity of it?
5) You are given an array, which represents stock prices over time. Value at index i represents the stock price at time i. You can buy a stock at some point and sell it later on. Write code to compute the maximum possible profit?
6) Some Java related conceptual questions.
— A string is passed to a method by value and the method changes the local string’s value, will the original string’s value change? why? (after answering this, he said, what if we make a new class for string named myString and use it instead, will it change anything?)
— Multithreading: What is multithreading? How would you implement it? How does “synchronized” work?
7) How do you initialize an array using a pointer? How do you initialize a 2D array using pointers?
1) You are given a linked list. You don’t know its size. How will you find the Nth element from the end? How will you find out middle element?
3) You are given an array of size n. Contains integers from 0 to n-1 (unsorted). Now if one of the elements is changed to 0. How will you find out which value was changed?
4) Same as (2) of Round 1. Asked me whether we need to override hashCode method.
5) You are given two strings. How will you check if these are anagrams?
6) You are given a sorted array (1-indexing) of n elements. n is a very big number. O(n) fails the time limit. Moreover, a = 1, a = 2, a = 3, …, a[n] = n. At some point, an error is made while setting the values. for example,
a = 1
a = 2
a = 3
a = 5
a = 6
a = 7…
Find out at which position the error is made.
7) Any questions?
Verdict: Selected 😀