# Samsung R&D Interview Experience | On-Campus 2019

I got selected in Samsung R&D Institute Bangalore on Sept 4th, 2019.

**Position :** Software Engineer (Networks S/W R&D)

**Place Of Posting :** Bangalore

**CGPA Cut-off :** 7.0

**Round 1:**

First round was an online coding round in which we are allowed to do it in their own coding platform. We are not supposed to use any in-built library functions except those of basic functions such as memory allocation/deallocation, printing and scanning. It consists of one question with time 3hrs. The problem consists of 50 test cases. Only those people will be selected who clears all the 50 test cases.

- Given a binary matrix of size m*n. A laser when applied along a column, complement the entire column(changes 0’s to 1’s and vice versa). Given k, the number of times laser to be applied along columns. You can apply laser on any column any number of times such that total number of times laser applied is k. Rank of matrix is the number of rows with each entire row consisting of 1’s. After applying the laser k times on the given matrix, the problem is to find the maximum rank.
- I have created a binary array of size m. 0 and 1 at ith index in the array indicates laser is applied even and odd number of times across the ith column(1 in ith index of binary array indicates to complement ith column in binary matrix). Let s be the sum of the binary array. If (k-s) is a multiple of 2 then it is the case that laser is applied k times. For each permutation of the binary array if the above condition is satisfied, rank will be calculated from the laser applied matrix by counting the number of rows with each element as 1 and max_rank will be updated with rank if rank>max_rank.

Normal brute force solution won’t pass all the test cases. I am not sure whether there is any DP solution with less time complexity.

I am the only one to get shortlisted for interview. The further rounds were conducted online through skype.

**Round 2:**

This round starts with discussion on the first round coding question. Here are some questions that I remember during my interview.

- What is your favourite sorting algorithm?
- Complexities of insertion and deletion in a heap. Height of a heap.
- How will you find kth bit in binary representation of a number?
- Basic questions on syntax and semantics of memset function.
- What is Dynamic Programming? What are the different approaches in DP and what is the difference between the methods?
- What are the different system-calls and explain them in detail?
- What is mutex and how is it different from semaphore?
- Given an array and sum. Find whether any number of elements in the array add to the given sum or not.

First I explained the brute force solution by finding all the subsets of the array and adding them. Later I gave him the approach of DP. He asked me to write the entire code in any language and asked to construct the DP table for an example.

- Design an algorithm to maintain dynamic memory allocation.

First I tell the basic approach to maintain all the memory blocks using a binary array(1 indicates the corresponding memory block used). Then I suggested that we can represent it by linked list ADT(refer to fixed memory allocation in https://silcnitc.github.io/run_data_structures/heap.html)

**Round 3:**

This round starts with asking my feedback on previous round. I explained about my project during summer internship. I have been asked a lot of queries(NOSQL and SQL). This goes upto 45 min.

Few other questions were asked in java.

- What is the difference between class variable and static variable?
- Explain the different types of access modifiers?
- Explain briefly about the memory allocation for different types of variables? How a class variable is invoked?
- When two variables point to same memory location and one variable frees the memory location. Now where will the other variable point to?
- Explain the concepts of inheritance, polymorphism, encapsulation, data abstraction?
- How do you detect a loop in a linked list?

**Tips**

- Practice coding questions on geeksforgeeks, hackerrank. Solve as many as possible.
- Don’t add too many projects in resume.
- Refer “DSA by Narasimha Karumanchi” for Data Structures and Algorithms.
- Be confident on what you are saying.

All the best for your placements…