Samsung visited our campus in August 2019 for hiring interns. The first round was an online test which comprised three coding questions to be solved in 60 minutes. Different students were allocated different questions; some of them being:
1) Reverse all words of a string using strictly O(1) space.
2) Count all nodes in a tree such that their key is equal to the sum of keys of left child and right child.
3) Graph based problem.
The questions were easy but there were many hidden test cases; code must be covering all edge cases.
Out of 200+ students who appeared for the test, 37 were shortlisted.
It was a paper-pen coding round where groups of 5 were made and each student was supposed to write down an efficient algorithm for the problem statement given to him/her individually. We were asked questions based on it and its relevant concepts. From groups of 5, 3 students were shortlisted. Some of the questions were:
1. Fractional knapsack and implementing it using dynamic programming ( modify 01 knapsack).
2. Longest Palindromic Substring
3. In a matrix consisting of 0s and 1s, find the number of Hs and Ts formed by 1s.
4. Arithmetic operations for very large numbers stored in linked list format.
Again, out of 37, 27 students were selected.
It was a one-to-one technical round. The interviewers were testing students’ knowledge from different perspectives. My interviewer was very friendly, but tried to confuse me several times.
1. Find out longest common sub-sequence
I did not write the code; but on paper and pen started explaining him everything right from dynamic programming to memoization, and how actually LCS algorithm works step by step using an example. He was satisfied.
2. A 5 m long wire when cut into 1 m wires has selling price 2 rs/m, 2 m wires has SP 5 rs/m, 3 m wires has SP 7 rs/m and 4 m wires has SP 8 rs/m. Find out how should a wire of given length be cut to give maximum SP.
I started using the greedy approach but he tried to manipulate me saying that dynamic programming is the solution ; using a 2d table. After thinking a lot I did not budge and gave him a solution using greedy programming to which he agreed.
3. Given a base class and derived class, can a base class object call a derived class constructor? Is the vice-versa possible?
4. Concept of inner classes in Java and their various types.
Here I was expected to write the name and syntax of all possible types.
5. Hashing and popular methods of collision resolution.
6. The famous “burning wires” puzzle.
and a few more technical questions were asked.
My interview lasted for 45 minutes. At the end 21 students were selected. I am thankful to GeeksforGeeks and the community here for providing such wonderful resources that helped me prepare for the test and interview.