Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Samsung R&D Institute interview experience Real time questions & tips from candidates to crack your interview

SDE - 1

Samsung R&D Institute
upvote
share-icon
4 rounds | 7 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 months
Topics: Recursion (Backtracking, Permutation and Combination), Graph(BFS, DFS, Disjoint Set Union), Tree, Trie, Sliding Window
Tip
Tip

Tip 1 : Focus primarily on DSA. Do daily practice on Codestudio/Leetcode/GFG and give contests.
Tip 2 : Build at least one end to end project which showcases your expertise in that domain. Provide the application/GitHub link that you have built in your resume

Application process
Where: Other
Eligibility: CGPA 7 and above
Resume Tip
Resume tip

Tip 1 : Strictly keep a single page resume. 
Tip 2 : Include only necessary information in the resume like education, skills, projects, papers, Links to coding platforms. 
Tip 3 : Highlight those skills which are relevant for the role you are applying.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration90 minutes
Interview date13 Jan 2022
Coding problem3

First round was a coding round held on CoCubes platform. There are 3 coding questions to be solved in 90 minutes. One can expect questions from Graph, DP, and Backtracking. No STL was allowed. I was able to solve all the three questions but the final result of test cases was not shown to the user. So to be on the safer side always write the optimized code if you have enough time remaining. Those who solved 2 questions also advanced to the next round.

1. Merge Intervals

Moderate
20m average time
80% success
0/80
Asked in companies
GoogleInnovaccerFacebook

You are given N number of intervals, where each interval contains two integers denoting the start time and the end time for the interval.

The task is to merge all the overlapping intervals and return the list of merged intervals sorted by increasing order of their start time.

Two intervals [A,B] and [C,D] are said to be overlapping with each other if there is at least one integer that is covered by both of them.

For example:

For the given 5 intervals - [1, 4], [3, 5], [6, 8], [10, 12], [8, 9].

Since intervals [1, 4] and [3, 5] overlap with each other, we will merge them into a single interval as [1, 5].

Similarly, [6, 8] and [8, 9] overlap, merge them into [6,9].

Interval [10, 12] does not overlap with any interval.

Final List after merging overlapping intervals: [1, 5], [6, 9], [10, 12].
Problem approach

This is a fairly easy problem. The approach is to sort the given array of intervals and insert the first interval to our answer. Now we check whether the adjacent intervals overlap or not. If they do not overlap we add them to our answer. If they do overlap we merge it to the last interval we added to our answer. Since the constraints were small and STL was not allowed I applied bubble sort.

Try solving now

2. Path Sum ll

Moderate
25m average time
75% success
0/80
Asked in companies
AmazonSamsung R&D InstituteMedia.net

Kevin has written some integers on a paper. He then selects some integers and draws a line between them. Fortunately, his diagram represents a binary tree. Today, his friend challenged him to find the paths that start from root and end at the leaf in his diagram whose sum is exactly equal to the number ‘K’. But, Kevin has another important piece of work and so, he appoints you to do his task.

All you have to do is to find the paths in his diagram whose sum is exactly equal to the number ‘K’.

For Example:

Example

Consider the above binary tree. If ‘K’ is 15 then the required paths are [5, 6, 4] and [5, 15, -5].
Problem approach

1) Keep storing the values of nodes while doing the preorder traversal,
2) If we are at particular node ,lets say "x" then we must have the sum of all the nodes in root to x path,
3) We will keep track of current sum also
4) Whenever we reach left Node , we will check whether the current Sum == target Sum,if yes then we can push one Path to the answer.

Try solving now

3. Binary Tree Maximum Path Sum

Moderate
20m average time
80% success
0/80
Asked in companies
HikeFacebookSamsung

You are given a binary tree with ‘N’ nodes.

Your task is to find the “Maximum Path Sum” for any path.

Note :

1. A ‘path’ is a sequence of adjacent pair nodes with an edge between them in the binary tree.
2. The ‘path’ doesn’t need to pass through the root.
3. The ‘path sum’ is the sum of the node’s data in that path. 
Problem approach

The idea is to update node values with the biggest, positive cumulative sum gathered by its children:

- If both contributions are negative, no value is added.
- If both are positive, only the biggest one is added, so that we don't include both children during the rest of the tree exploration.
- Leaves return its own value and we recursively work our way upwards.
- A global maximum sum variable is maintained so that every path can be individually checked, while updated node values on the tree allow for exploration of other valid paths outside of the current subtree.

Try solving now
02
Round
Medium
Video Call
Duration60 minutes
Interview date15 Jan 2022
Coding problem3

Second round was conducted on Samsung Knox Meeting. After the introductions I came to know that my interviewer was from Cloud Domain so I was expecting questions from Cloud technology. Interview began with coding question involving Trie which I was able to solve. Second question was based on Disjoint Set. Lastly he asked about my projects and since I had certification in AWS he also asked about AWS services like Fargate, Serverless technology and some basic cloud related questions.

1. Implement Trie ll

Moderate
30m average time
70% success
0/80
Asked in companies
AmazonAppleMicrosoft

Ninja has to implement a data structure ”TRIE” from scratch. Ninja has to complete some functions.

1) Trie(): Ninja has to initialize the object of this “TRIE” data structure.

2) insert(“WORD”): Ninja has to insert the string “WORD”  into this “TRIE” data structure.

3) countWordsEqualTo(“WORD”): Ninja has to return how many times this “WORD” is present in this “TRIE”.

4) countWordsStartingWith(“PREFIX”): Ninjas have to return how many words are there in this “TRIE” that have the string “PREFIX” as a prefix.

5) erase(“WORD”): Ninja has to delete one occurrence of the string “WORD” from the “TRIE”.

Note:

1. If erase(“WORD”) function is called then it is guaranteed that the “WORD” is present in the “TRIE”.

2. If you are going to use variables with dynamic memory allocation then you need to release the memory associated with them at the end of your solution.

Can you help Ninja implement the "TRIE" data structure?

Problem approach

Step 1 : I started with brute force approach by using unordered_map. Operations like storing and erasing can be done in constant time however counting words with a given prefix resulted in O(n^2) time complexity. The interviewer was not happy with the approach and asked me to optimize it.
Step 2 : The optimized approach is to use Trie. I built class for implementing Trie as it looks cleaner and demonstrates your ability to write OOP code. Using Trie I maintained Nodes which have references to other Nodes. Every node of Trie consists of multiple branches. Each branch represents a possible character of keys. We need to mark the last node of every key as the end of the word node. A Trie node field say isEndOfWord is used to distinguish the node as the end of the word node. All the operations now can be done in O(Length of Longest word) which is constant time. I also discussed with interviewer the disadvantage of Trie which is that it takes a lot of memory of store all strings.

Try solving now

2. Find the number of states

Moderate
15m average time
85% success
0/80
Asked in companies
AmazonSamsung R&D InstituteIntuit

You are given ‘n’ cities, some of which are connected by bidirectional roads. You are also given an ‘n x n’ matrix i.e. ‘roads’, where if city ‘i’ and ‘j’ are connected by a road then ‘roads[i][j]'= 1, otherwise ‘roads[i][j]' = 0.


A province is a group of cities that are either directly or indirectly connected to each other through roads.


The goal is to count and return the total number of such provinces in the given matrix.


Example:
n = 4, roads = [ [1, 1, 1, 0],
                 [1, 1, 1, 0],
                 [1, 1, 1, 0],
                 [0, 0, 0, 1] ]

example

So, there are ‘2’ provinces.
Note:
1. A city is connected to itself. So, for every city ‘i’, ‘roads[i][i] = 1’.
Problem approach

This question can be solved using BFS, DFS and Disjoint Set Union. Again I wanted to demonstrate my OOP skills so I decided to go with DSU. I created a class for DSU and added Union and Find functions to it and initialized the class fields in the constructor. It is highly recommended to create classes as that's how you will be coding in the company as well. In DSU we maintain a set of nodes which are connected to each other. I used the Union function of DSU to connect the cities and Find function to calculate the parent of each city. Further I used Union by Rank and Path Compression to optimize my code. The number of provinces is same as the number of parents we have after the applying the Union operation for each edge

Try solving now

3. Technical Questions

I had worked on AWS and deployed containers on AWS Fargate which is a serverless offering from AWS. Since he was from Cloud domain he asked me regarding basics of Docker and some questions on basis of cloud. Discussion revolved around scaling infrastructure, networking and monitoring the infrastructure (CloudWatch):
- What is Docker?
- What is Serverless?
- Difference between Containerization and Virtualization
- How to handle networking between containers?
- What is Saas, Iaas, Paas?

Problem approach

Tip 1 : Put only those skills in resume which you are familiar with. You will mostly likely be questioned on things which you have mentioned in your resume.
Tip 2 : Cloud Computing is a hot topic right now and having knowledge on it gives added advantage over other developers

03
Round
Easy
HR Round
Duration30 minutes
Interview date16 Feb 2022
Coding problem0

HR Round was discussion on previous company work and technology I had worked on. I was asked about my preferences regarding which technology I would like to work on and finally there was salary discussion.
HR told me that after joining there would be Software Competency Advance Test to be conducted which needs to be cleared within probation period to get Full time Offer. Samsung usually conducts this test on site before joining for freshers but for experienced it is conducted during probation period.

04
Round
Medium
Online Coding Interview
Duration180 minutes
Interview date4 Apr 2022
Coding problem1

Samsung SWC Advance Test conducted on Samsung's internal platform.

1. Constellation

Easy
10m average time
90% success
0/40
Asked in companies
Tata Consultancy Services (TCS)Samsung R&D Institute

Given a matrix ‘UNIVERSE’ with 3 rows and ‘N’ columns, with the characters { # , * , . } and these characters represent a cluster of stars and galaxies in space. Stars are represented by ‘*’ symbol. The ‘.’ symbol represents empty space.


We define a constellation as a 3x3 matrix which contains stars in the shape of vowels. A group of constellations is defined as a galaxy. Note that a galaxy may contain many stars but they will never be overlapping. Two galaxies are separated by a column of ‘#’.


Given the ‘UNIVERSE’ matrix, print a string which denotes all the vowels formed by stars and ‘#’ present in the matrix.


A looks like this :
. * .
* * *
* . *
E looks like this :
* * *
* * *
* * *
I looks like this :
* * *
. * .
* * *
O looks like this :
* * *
* . *
* * *
U looks like this :
* . *
* . *
* * *


Note :
It is guaranteed that no two constellations are overlapping.


Problem approach

This problem can be solved using BFS. Using BFS calculate the closest constellation among all the constellations for a given point and add that point in the constellation. However out of 50 testcases only 35 were passing and for the rest it was giving TLE. Optimized approach was to to use DSU to form sets for constellations and add a point to another constellation if it is at a lower distance. 50/50 test cases passed.

Try solving now

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

Which of these access modifiers must be used for the main() method?

Choose another skill to practice
Start a Discussion
Similar interview experiences
company logo
SDE - 1
3 rounds | 3 problems
Interviewed by Samsung R&D Institute
0 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 6 problems
Interviewed by Samsung R&D Institute
865 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 3 problems
Interviewed by Samsung R&D Institute
844 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 6 problems
Interviewed by Samsung R&D Institute
705 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
105677 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
50464 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
31415 views
6 comments
0 upvotes