# Samsung Interview Experience | Set 28 (On-Campus)

• Difficulty Level : Hard
• Last Updated : 06 Sep, 2017

Recently, Samsung Bangalore visited our campus for full-time recruitment. There was an online coding round followed by 3 interview rounds(2 Tech + 1 HR).

Round 1: Online coding round
This was a 3 hours coding round in which we had to code 1 problem having 50 test cases. Only those students were selected for the next round who passed all the test cases. Here is the question:
You’ll be given a grid as below:

```                           0 1 0 2 0
0 2 2 2 1
0 2 1 1 1
1 0 1 0 0
0 0 1 2 2
1 1 0 0 1
x x S x x
```

In the grid above,
1: This cell has a coin.
2: This cell has an enemy.
0: It contains nothing.
The highlighted(yellow) zone is the control zone. S is a spaceship that we need to control so that we can get maximum coins.
Now, S’s initial position will be at the center and we can only move it right or left by one cell or do not move.
At each time, the non-highlighted part of the grid will move down by one unit.
We can also use a bomb but only once. If we use that, all the enemies in the 5×5 region above the control zone will be killed.
If we use a bomb at the very beginning, the grid will look like this:

```                           0 1 0 2 0
0 0 0 0 1
0 0 1 1 1
1 0 1 0 0
0 0 1 0 0
1 1 0 0 1
x x S x x
```

As soon as, the spaceship encounters an enemy or the entire grid has come down, the game ends.
For example,
At the very first instance, if we want to collect a coin we should move left( coins=1). This is because when the grid comes down by 1 unit we have a coin on the second position and by moving left we can collect that coin. Next, we should move right to collect another coin( coins=2).
After this, remain at the same position( coins=4).
This is the current situation after collecting 4 coins.

```0 1 0 2 0                0 1 0 0 0
0 2 2 2 1 -->after using 0 0 0 0 1
x x S x x -->bomb        x x S x x
```

Now, we can use the bomb to get out of this situation. After this, we can collect at most 1 coin. So maximum coins=5.

Solution:
Brute Force: At each step, we have 6 options:
1. Move left, right or do not move.
2. If we haven’t used bomb yet, blast the bomb and then move right, left or do not move.

I wrote a recursive function for this considering all the 6 cases.

Tips:
In general, Samsung doesn’t ask difficult coding questions and the constraints won’t be too hard. So, almost every time a brute force solution will suffice. Just try to make sure that you consider all the corner cases because if you don’t pass all the cases, they won’t select you for the next round.
Usually, the question is based graphs or backtracking/recursion. So, try to brush up these topics well.

17 students were shortlisted for the next round.
Round 2: Tech 1
At the beginning, the interviewer went through my entire resume line by line.
Then, he started asking me questions related to the projects that I did during my internships. He actually asked some really good questions, so try to go through your resume very well before the interview.
The interviewer was a nice guy. Finally, he asked me about my favorite subject and then told me to wait outside. It lasted for around 30 minutes.

After this 9 students were shortlisted.
Round 3: Tech 2
As soon as I entered the room, the interviewer offered me some snacks and explained me a very easy question related to arrays and gave me 10 minutes to write it’s code on a paper. I wrote it quickly and explained it to him. He was satisfied.
Then, he asked me a simple design problem based on graphs. After this, he asked me certain questions like:
2. Another design problem in which he also asked me about synchronization in OS, mutex, message passing etc.
3. Protocols in various layers of TCP/IP.
4. Difference between TCP and UDP.
5. Polymorphism in OOPs. Early binding and late binding. And some other basic OOPs questions.

After this 6 students were shortlisted for the HR round .
Round 4: HR
2. As I’m an ECE student, She asked me why are you looking for a software job.
3. Why Samsung?
4. Why should we hire you?
5. And then she asked me if I had any questions. I asked her a couple of questions and after that, she told me to wait for the results.

Finally, 5 students for selected. I was also selected :).

This article is contributed by Abhsihek Arya. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.