Samsung R & D Interview Experience
Round 1: Online Coding Round First round is an online programming round with 2 questions.
- Given an array of elements and change the array in such a way that all the elements on the array are distinct. if you are replacing a value, then the replacing value should be great than the previous value and after modification sum of the elements should be as less as possible.
Input: arr[1, 2, 3, 4, 5, 5, 5] and the result should be [1, 2, 3, 4, 5, 6, 7]
Input: arr[1, 2, 5, 7, 8, 8, 7] and the result should be [1, 2, 5, 7, 8, 9, 10] or [1, 2, 5, 7, 8, 10, 9]
- The second question is similar to LCS with a slight modification. that is Find the longest common subsequence that all the characters present in the subsequence should be of vowels.
input: abcef, ffiocd then the answer should be 3 (abc, ioc)
Questions asked in the 3-hr coding round for Samsung R&D recruitment
- There is a single problem statement that involves concepts like Backtracking (recursion), Graphs(Traversal, Coloring, etc).
Now the points to be noted are:
- You have to code in a coding editor which is provided by Samsung.
- You have to implement required data structures like stacks, queues, etc from scratch and you are not allowed to use default data structures (like STL in C++ or Collection in JAVA) provided by the programming languages.
- There are generally 50 test cases or more (in my case there were 100), all of which have to be passed in order to get selected.
- The Stack size and Heap size are limited. I can’t recall the exact restrictions but they require you to code an efficient solution. Generally what happens is that during backtracking the number of recursive calls gets out of bounds leading to filling up of stack memory and eventually wrong answers. So try to eliminate duplicate cases during backtracking and the number of variables used. Design your solution keeping these things in mind.
- No other library except I/O is allowed to be used.
- In my experience backtracking problems come in the form of a puzzle, and the problems on graphs are not very twisted and you can easily figure out what to use.
- The number of submissions allowed is capped to 10 but you can run test cases any number of times even with your own test cases.
My Personal Notes arrow_drop_up