Skip to content
MH
All posts
  • Samsung R&D Institute Bangladesh
  • Samsung Internship Interview
  • Software Engineer Intern
  • Interview Experience
  • C++
  • Competitive Programming
  • BFS
  • Breadth First Search
  • Graph Algorithms

Samsung R&D Institute Bangladesh Software Engineer Intern Interview Experience

Read my Samsung R&D Institute Bangladesh Software Engineer Intern interview experience, from CV screening to a 4-hour HackerRank coding test and viva. Learn about the C++ BFS solution I used, the interview process, and practical lessons for aspiring software engineering interns.

Mehedi Hasan9 min read

Samsung R&D Institute Bangladesh Interview Experience: 4-Hour Coding Test & Viva

Disclaimer: This article describes my personal experience during a recruitment process at Samsung R&D Institute Bangladesh. The hiring process may vary depending on the position, team, and recruitment cycle.

Getting an opportunity to interview with a well-known research and development organization is exciting, especially for someone who enjoys competitive programming and problem-solving.

I once had the opportunity to participate in the recruitment process at Samsung R&D Institute Bangladesh. Unlike a typical coding assessment with several short problems, my technical assessment involved just one programming problem with a four-hour time limit.

I managed to solve the problem and was subsequently called for the viva round.

However, my journey did not end with a job offer. I unfortunately missed the follow-up HR call and email. At that time, I was already working, and in hindsight, I may not have given the opportunity the attention it deserved.

In this article, I'll share the recruitment stages I experienced, the programming problem I was given, my C++ solution using Breadth-First Search (BFS), and some lessons for candidates preparing for similar software engineering opportunities.

Samsung R&D Institute Bangladesh Interview Process

The process I experienced consisted of three stages:

  1. CV screening
  2. Technical coding assessment - 4 hours
  3. Viva

Round 1: CV Screening

The first stage was CV screening.

My CV was reviewed before I moved to the technical assessment. This is a reminder that your CV is an important part of the recruitment process, even when the role places a strong emphasis on programming skills.

For fresh graduates and junior software engineers, I recommend highlighting:

  • Programming languages and technical skills.
  • Competitive programming achievements.
  • Academic and personal projects.
  • GitHub repositories and relevant code samples.
  • Internship or professional experience.
  • Relevant academic achievements.

Keep your CV clear, concise, and honest. Be prepared to explain the technologies and projects you mention.

Round 2: One Programming Problem in Four Hours

After passing the CV screening, I was given a programming problem to solve.

The unusual part was that there was only one problem, and I had four hours to solve it.

The problem was available on HackerEarth:

Open the original HackerEarth problem

I solved the problem using C++. My solution used Breadth-First Search (BFS) to traverse a grid while respecting the connections allowed by each cell.

This assessment was a good example of how a single algorithmic problem can test several skills at once:

  • Understanding the problem statement.
  • Choosing an appropriate algorithm.
  • Modeling the problem as a graph.
  • Implementing the solution correctly.
  • Handling boundary conditions.
  • Avoiding revisiting already processed cells.
  • Managing time during a long coding assessment.

Understanding the problem through my solution

My implementation models the grid as a collection of cells connected by pipes. Each pipe type determines which directions a person can move from that cell.

The solution explores reachable cells from a starting position, subject to the maximum allowed length L.

The important observation is that a connection is valid only when both neighboring pipe cells allow the connection. A cell that permits movement to the right cannot connect to a neighboring cell that does not permit movement to the left.

This makes the problem suitable for BFS.

My C++ Solution

Here is the solution I submitted during the assessment, reproduced from my implementation.

cpp
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>
#include <algorithm>
using namespace std;

const int dx[] = {-1, +1, 0, 0};
const int dy[] = {0, 0, -1, +1};

bool isValid(int i, int j, int n, int m) {
    return !(i < 0 || j < 0 || i >= n || j >= m);
}

vector<vector<int>> connectivity = {
    {},
    {0, 1, 2, 3},
    {0, 1},
    {2, 3},
    {0, 3},
    {1, 3},
    {1, 2},
    {0, 2}
};

int opposite[] = {1, 0, 3, 2};

int bfs(int n, int m, int r, int c, int len,
        vector<vector<int>>& v) {

    vector<vector<int>> vis(n, vector<int>(m, 0));
    queue<tuple<int, int, int>> q;

    vis[r][c] = true;
    q.push({r, c, 1});

    int cnt = 1;

    while (!q.empty()) {
        auto [x, y, length] = q.front();
        q.pop();

        if (length == len)
            continue;

        int pipeType = v[x][y];

        for (auto dir : connectivity[pipeType]) {
            int newX = x + dx[dir];
            int newY = y + dy[dir];

            if (!isValid(newX, newY, n, m) ||
                vis[newX][newY]) {
                continue;
            }

            int newPipeType = v[newX][newY];

            auto it = find(
                connectivity[newPipeType].begin(),
                connectivity[newPipeType].end(),
                opposite[dir]
            );

            if (it != connectivity[newPipeType].end()) {
                vis[newX][newY] = true;
                q.push({newX, newY, length + 1});
                cnt++;
            }
        }
    }

    return cnt;
}

int main() {
    int t;
    cin >> t;

    while (t--) {
        int n, m, r, c, l;
        cin >> n >> m >> r >> c >> l;

        vector<vector<int>> v(n, vector<int>(m, 0));

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                cin >> v[i][j];
            }
        }

        cout << bfs(n, m, r, c, l, v) << '\n';
    }
}

Note: This is the code from my original solution. The structured binding syntax in the BFS loop requires C++17 or later.

Explaining the BFS Approach

If you're preparing for a similar coding assessment, understanding why this solution works is more useful than memorizing the code.

1. Represent the four directions

I used two arrays to represent movement:

cpp
const int dx[] = {-1, +1, 0, 0};
const int dy[] = {0, 0, -1, +1};

The direction indices represent:

Direction indexMovementMeaning
0(-1, 0)Up
1(1, 0)Down
2(0, -1)Left
3(0, 1)Right

This allows us to move between adjacent cells without writing four separate blocks of code.

2. Define the connections for each pipe type

Different pipe types permit different combinations of directions.

cpp
vector<vector<int>> connectivity = {
    {},
    {0, 1, 2, 3},
    {0, 1},
    {2, 3},
    {0, 3},
    {1, 3},
    {1, 2},
    {0, 2}
};

For example, pipe type 1 allows movement in all four directions, while pipe type 2 permits movement up and down.

The connectivity array makes these rules easy to check.

3. Check whether a neighboring cell is valid

Before visiting a neighbor, we need to make sure its coordinates are inside the grid.

cpp
bool isValid(int i, int j, int n, int m) {
    return !(i < 0 || j < 0 || i >= n || j >= m);
}

Without this check, moving outside the grid could cause an out-of-bounds memory access.

4. Check both sides of a connection

This is one of the most important parts of the solution.

cpp
int opposite[] = {1, 0, 3, 2};

If we move up from the current cell, the neighboring cell must permit movement down. Similarly, moving left requires the neighboring cell to permit movement right.

The code checks whether the neighboring pipe allows the opposite direction:

cpp
auto it = find(
    connectivity[newPipeType].begin(),
    connectivity[newPipeType].end(),
    opposite[dir]
);

Only when this direction exists do we add the neighbor to the BFS queue.

5. Use BFS to count reachable cells

BFS explores cells in increasing order of distance from the starting cell.

The queue stores three values:

cpp
queue<tuple<int, int, int>> q;

They represent:

  • Row coordinate.
  • Column coordinate.
  • Length or level of the path from the starting cell.

The starting cell is assigned length 1. Once a cell reaches the maximum allowed length L, the algorithm doesn't explore its neighbors.

The vis matrix ensures that each cell is counted only once.

Complexity Analysis

Let N be the number of rows and M be the number of columns.

Each cell is visited at most once. Every cell has at most four neighboring cells, so the BFS traversal takes:

  • Time complexity: O(N × M)
  • Space complexity: O(N × M)

The visited matrix and BFS queue can both require space proportional to the number of cells.

Round 3: Viva

After solving the programming problem, I was called for the viva/interview round.

Reaching this stage was encouraging because I had successfully completed the coding assessment.

I don't want to invent interview questions or details that I cannot reliably recall. The important point from my experience is that solving the technical problem was not the final step in the recruitment process.

If you are preparing for a similar interview, be ready to explain your own solution:

  • Why did you choose BFS?
  • How does a queue work?
  • Why do you need a visited matrix?
  • How do you ensure the pipe connections are valid?
  • What is the time complexity?
  • What edge cases did you consider?
  • How would you test your implementation?

These are useful preparation questions for a grid-based BFS solution, not a claim that Samsung asked me each of them.

What Happened After the Interview?

I was subsequently contacted through HR, but unfortunately, I missed the HR call and email.

At that time, I was already employed, and looking back, I may not have been as attentive to the opportunity as I should have been.

I share this because the recruitment process does not end when you pass a coding assessment or receive an interview invitation. You also need to monitor your email, check missed calls, and respond to recruiters promptly.

If you are actively applying for jobs, make it a habit to check your inbox, spam folder, and phone regularly.

What I Learned From This Experience

1. One problem can require deep problem-solving

A single four-hour coding problem can test much more than syntax. You need to understand the problem, identify the right algorithm, and implement it carefully.

2. Understand algorithms instead of memorizing code

Knowing BFS as a concept helped me model the grid as a graph and traverse reachable cells. Understanding the algorithm makes it easier to adapt when the problem statement changes.

3. Pay attention to edge cases

Boundary checks, invalid connections, visited cells, and the maximum allowed path length can all affect correctness.

4. Practice explaining your code

Passing a coding assessment is valuable, but you should also be able to explain your approach, implementation decisions, and complexity clearly during a viva.

5. Follow up on recruitment communication

My biggest non-technical lesson was to take every recruiter call and email seriously, even when I already have a job.

An opportunity is only useful if you respond to it.

How to Prepare for Similar Software Engineering Interviews

If you're a student or a recent graduate preparing for software engineering opportunities, I recommend focusing on the following:

Data structures and algorithms

  • Arrays and strings.
  • Stacks and queues.
  • Binary search and sorting.
  • Trees and graphs.
  • BFS and DFS.
  • Time and space complexity.

C++ fundamentals

  • STL containers.
  • vector, queue, tuple, and pair.
  • References and pointers.
  • Standard algorithms such as find.
  • Debugging and boundary conditions.

Interview communication

  • Explain the problem in your own words.
  • Describe your approach before coding.
  • Justify your algorithm choice.
  • Discuss complexity.
  • Test your solution with small and edge-case inputs.

Practice solving problems independently under a time limit, then review your implementation and explain it as if you were in an interview.

Final Thoughts

My Samsung R&D Institute Bangladesh interview experience was a valuable learning opportunity. I passed the CV screening, solved a single programming problem during a four-hour assessment, and advanced to the viva/interview stage.

Unfortunately, I missed the subsequent HR communication, so the process did not result in an offer.

Looking back, there are two lessons I would take from this experience: keep improving your problem-solving skills, and never neglect communication during a recruitment process.

I hope sharing my experience and C++ BFS solution helps other candidates prepare for similar software engineering opportunities.

About Me

I'm Md. Mehedi Hasan, a software engineer from Bangladesh who enjoys competitive programming, building software, and learning new technologies.

You can explore my projects and other interview experiences on my portfolio.

Good luck to everyone preparing for their next interview!

Last updated

Share