Question: Samsung (SRIB), On-Campus SE internship 2022
0
Entering edit mode

CGPA cutoff: 7

Branches: CSE, ECE, EEE

Stipend: 50k/month

Location: Bangalore

Verdict: Selected

Online Assessment:

It was a 3-hour online test, and 3 questions were asked. First question was based on strings, second question was based on trees and third question was to find the number of bridges in a graph.

7 candidates were shortlisted for the interview.

Technical interview:

There was only one interview after the online assessment. Interviewer asked me about my projects in depth. This went on for about 20 minutes.

Then the interviewer asked me some MCQs based on OOPS, including inheritance and virtual functions.

Then I was given a DSA question based on stacks and queues and I was asked to write the pseudocode for it.

After that I was asked 6-7 DSA problems:

1) Find the kth smallest element in an unsorted array

Click here to Practice

2) Search for a given number X in a matrix of sorted rows and sorted columns, the first element of next row is greater than the element of previous row

3) Search for a given number X in a matrix of sorted rows and sorted columns, the first element of next row need not be necessarily greater than the element of previous row

4) Find kth smallest element in a matrix of sorted rows and sorted columns

5) Find kth smallest element in a BST

6) Find the intersection of two given linked list

Only the logic was discussed for these questions. I explained the naive approach first and then explained the efficient approach, with optimal time and space complexity.

I asked few questions to the interviewer before the interview ended.

Overall, the interview went for about one hour. 5 candidates were finally selected.

Tips:

Try to think loud and keep communicating with the interviewer. Interviewer wants to know your approach throughout the discussion of the problem.

Do some research about the company so that you can ask questions to the interviewer. It makes a good impact

0
Entering edit mode

Question 1

Overview

  • We are given an unsorted array and we have to find the kth smallest element in it.

Solution

  • The easiest solution is to sort the array.
  • Then since the array has 0-based indexing print out the arr[k-1].

Code

ll n, k;
cin >> n >> k;
vector<ll> a(n);
for (ll i = 0; i < n; i++)
{
    cin >> a[i];
}
sort(all(a));
k--;
cout << a[k] << endl;
return;
ADD COMMENTlink 2.0 years ago Ujjwal Srivastava 320

Login before adding your answer.

Similar Posts
Loading Similar Posts