Goldman Sachs Interview Experience for SDE 2 (1.5 Yrs Exp) 2022
Coding Round:
- Given a number x, and a range of y to z. Please find the count of all the numbers in the range. Such that the product of the numbers n and x does not contain any digit from the number n.
Input: 2 10 15
Output: 4 - Number Pattern: Given a pattern containing Ns and Ms. N represent ascending, M represents descending. The sequence is given (let’s say NMMNM), digits that can be used 1-9 (digits can’t repeat.) Output: Min number for the given sequence.
Input: M
Output: 21
Telephonic Round 1:
- Encode the string such that:
Eg1. String= abcabc
Encoded string=abc*
Eg2. String= ababababba
Encoded=ab**ba
If the string matches with the start to that digit then replace it with a *.
https://www.w3wiki.net/run-length-encoding/
Round 1(F2F):
- Swap the elements if the first digit is less than the second one.
- In an array count the triplets with a sum greater than k.
- Difference between final finalize and finally.
- Different types of inheritance?
- Difference between inheritance in Java and Cpp.
- Difference between overloading and overriding?
- Aware of the self-binary tree?
- What is heap sort?
- Explain Merge Sort?
Round 2(F2F):
- https://www.w3wiki.net/find-possible-words-phone-digits/amp/
- (DFS/BFS) Check if the sensor can trigger the last sensor in a 2 D matrix. One sensor can trigger neighboring four sensors (right, left, up, down).
- Difference between abstract and Interface.
- Difference between Integer and int.
- How to use interface to extend 2 classes.
- Tricky questions on declaring class A, class B extending classes, which of the declarations are correct.
Class B extend A
a,b, alist, blist;
alist.add(b); blist.add(a); correct alist.addAll(blist); blist.addAll(alist); correct List<List<A>> all= ListList<L>() List<list<B> bll all.add(blist); bll.add(alist); class ALsit{ List<List<A>> l; } class BLsit extends ALsit{ List<List<B>> l; }
- What is different in Java 8?
- How to filter and return names using the lambda function in Java 8?
Round 3(F2F):
- https://www.w3wiki.net/find-a-tour-that-visits-all-stations/amp/ There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it costs consumption[i] of gas to travel from station i to its next station (i+1).gas={1,2,3,4,5}
consumption={3,4,5,1,2} - How is memory allocated in python?
- How is memory allocated in Java?
- What is stack heap?
- Difference between tag and element in HTML.
- Write endpoint (@Getmapping)
- Mutable class?
- Are you aware of the design pattern?
- How to write a singleton class?
- Write singleton class without using annotations.
Verdict: Rejected
Contact Us