Samsung RnD Coding Round Questions
This goes a bit different from all the processes mentioned on geeksforgeeks.
First-round was on Hackerearth, which was an open round, anyone can participate from 1 year to 11 years experience followed by Samsung Competency test and interviews.
Round 1: HackerEarth round(Screening round) Open contest
In this round, there were 2 very simple coding questions to be solved in 2hr 30 min. I was able to solve them in just over 1 hr. First question name was Optimal Path. and the second was Bit even Array. there were multiple questions, among which random questions was coming for any individual., Second was to find the min no of steps to make two strings identical. where we can only move one element at a time and we cannot move elements among strings. we have to either move the character or replace it swapping two also take 1 move while 1 move is for changing the character.
Round 2: Samsung Competency test
this round was supposed to be a third party location separate from Samsung ofc. This round was 4 hrs duration. where we have to solve 1 coding question on Samsung provided virtual environment thus no standard libraries are not working and we are limited to C, CPP, and java. and have to code everything needed ourselves like stack queue priority queue or hashing functions and could not use dynamic array. Just like in the visual studio, where we can not create array after taking input from the user at runtime, similarly here is the same and will throw an error.
Now coming to the question, I don’t remember the exact name of the question but it goes by, “Highway Repair 2″, It stated that we are given t test cases and in each test case we are given a number n which indicated the number of holes in the highway and it can be between 3 and 1000. and then an array of size n giving the position of all those holes in the highway and no 2 or more values in the array is same and all values start from 1. and then a value k which represent the patch size. Remember the patch size is constant, which will be of min 3 and max is 100. and if we are to patch any position then from the starting position it will be of k size only. no more no less. Remember all the numbers given will always be positive. now that we have the value n, k, and array of size n. we have to minimize and print overlapping of the patches as whenever there is some overlapping, it produces some harmful fumes for both humans and nature(from this sentence I think if we overlap certain piece of land more than 1, then our result will contain the no of times it was overlapped). Observe there is no max length given of highway, so I think we can go over the max size given during repair to reduce overlapping. (There is again no example or no explanation given to verify this claim).
I was able to pass the sample test cases using recursion and backtracking while going through each and every possible scenario but was unable to solve the question as this approach gave TLE but some test cases still pass. I needed to apply DP into it but was out of luck as wasn’t able to implement correctly.
Round 3: It was the continuation of round 2 or we can say part 2 of round 2 and was called after 2 weeks at the same center.
This time there were significantly fewer peoples. In second-round part 1, it was more than 120 easily and in this round, it was just 12 including me. I believe only those peoples who were able to solve the previous problem partially was called. This time again it was all same. just different question.
The question was based on the weight machine. IT’s name was “weight machine 1″. Again question start similarly. We are given weigh machine(Taraju in Hindi, and it was a two-sided weight machine, where we compare 2 different weights.) and some weights are given, along with 2 values A and B(Where 1<=A<B<10000) including A and B and we need to be able to produce all values/weights between those two numbers using those given weights(Suppose you have 2 weights of 1, 2 and need to make 3 then we can make it like 1+2 (Again on the same side of weighing machine thus we add) and in another example we are given values 1, 4 and need to produce 3 then we can do it like 4-1(weights on different sides thus we subtract)) and we are given value n denoting the number of weights given(3<=n<=30) followed by n numbers giving the weights of n different weights(0<weight<500) and no two weights can be same. (everything in this question is in grams. :p), Now in this question during producing all the numbers between A and B, if we are not able to generate any number, then we can add a new extra weight I, using which we must be able to produce all the numbers or weights between those values. If we don’t need extra weight then answer is ‘0’(zero) or we must print the extra added weights. We can only add 1 single weight in the array like the n+1th element. If we have more than one weights upon adding we can solve then we have to print the smallest of all. (for example if we can solve the problem by adding either 3 or 7 as Ith weight, then we must pick 3).
Test Case 1 – A = 1, B = 15, n = 4,
A = 1, 2, 4, 8
Ans = 0
explanation = we can generate all numbers without adding any number just by picking the specific number like
1, 2, 1+2, 4, 4+1, 4+2, 4+2+1, 8, etc.
Test Case 2 – A = 1, B = 10, n = 3,
A = 8, 9, 4
Ans = 1
explanation = we need to add 1 inorder to generate all numbers from 1 to 10 like
9-8, 1+9-8, 4-1, 4, 4+1, 9+1-4, 8-1, 8, 9, 9+1. THIS way we are able to generate all numbers within the range.
Range won’t always start with 1, it may start with 200 or even 5000, etc anywhere within the range.
Remember heap size is only 1MB so need to look for the memory constraint within the question.
Although I was able to generate all numbers but wasn’t able to identify I number or the result.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon. Google and Microsoft Test Serieses.