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

SDE - 1

Maersk
upvote
share-icon
2 rounds | 7 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6 months
Topics: Aptitude, SQL, Data structure, Dynamic Programming, Recursion, C++, Logical reasoning
Tip
Tip

Tip 1 : Read interview experience before interview
Tip 2 : Think loud about each coding question.

Application process
Where: Campus
Eligibility: 7 cgpa and no backlogs
Resume Tip
Resume tip

Tip 1 : No spelling mistake in resume.
Tip 2 : Resume should be in proper format

Interview rounds

01
Round
Medium
Online Coding Interview
Duration95 minutes
Interview date23 Oct 2020
Coding problem1

The 1st round was online coding + MCQ round. It had 3 sections in total to be solved in 95 mins.
Next comes the technical interview. 
The technical interview lasted for about 45 minutes. It started with a basic introduction. Then, she framed some questions from my resume and projects which I have mentioned. Questions were mainly from Data structure, OS, DBMS, SQL. She told me to rate my data structure skill on a scale of 1 to 5.
My interview was at 10:30 am and the interviewer was really nice. She was helping me wherever I was getting stuck.

1. Fourth Largest Element in the Array

Easy
20m average time
0/40
Asked in companies
MicrosoftCiscoBank Of America

You are given an array consisting of 'N' integers. You have to find the fourth largest element present in the array.

If there is no such number present in the array, then print the minimum value of an integer which is -2147483648.

Follow Up:
Try solving this problem in O(N) time complexity.
Problem approach

Sort the array and return second last element.

Try solving now
02
Round
Medium
Face to Face
Duration45 minutes
Interview date24 Jan 2021
Coding problem6

The technical interview lasted for about 45 minutes. It started with a basic introduction. Then, she framed some questions from my resume and projects which I have mentioned. Questions were mainly from Data structure, OS, DBMS, SQL. She told me to rate my data structure skill on a scale of 1 to 5.

1. Sort 0 1 2

Easy
22m average time
0/40
Asked in companies
IntuitFacebookMathworks

You have been given an integer array/list(ARR) of size 'N'. It only contains 0s, 1s and 2s. Write a solution to sort this array/list.

Note :
Try to solve the problem in 'Single Scan'. ' Single Scan' refers to iterating over the array/list just once or to put it in other words, you will be visiting each element in the array/list just once.
Problem approach

I started with a basic brute force approach by counting the number of 0’s,1’s,2’s. Let the count be x,y,z then we can traverse again and fill x nodes as 0 , y nodes as 1 and z nodes as 2.
Then the interviewer asked me to optimize the solution
Next comes the efficient solution
Iterate through the linked list. Maintain 3 pointers named zero, one, and two to point to current ending nodes of linked lists containing 0, 1, and 2 respectively. For every traversed node, we attach it to the end of its corresponding list. Finally, we link all three lists. To avoid many null checks, we use three dummy pointers zero, one and two that work as dummy headers of three lists.

Try solving now

2. Remove Duplicates

Easy
15m average time
80% success
0/40
Asked in companies
GoogleCIS - Cyber InfrastructureTata Consultancy Services (TCS)

Ninja is playing with numbers but hates when he gets duplicate numbers. Ninja is provided an array, and he wants to remove all duplicate elements and return the array, but he has to maintain the order in which the elements were supplied to him.

Problem approach

First solution using extra space:
1) We can make a set of integer.
2) Traverse the linked list and store the values in set.
3) After traversal the set will contain all those elements which are unique.
4) We can then copy those elements back to the linked list.


The interviewer asked me to optimize and asked me the complexity.

So second optimised solution:
1) Traverse the linked list.
2) If the current data is the same as the next node then delete the next node.
3) Before deleting a node, we need to store the next pointer of the node

Try solving now

3. Operating System

What is a semaphore?
What is race condition?

Problem approach

Tip 1 : Be accurate and give real-life examples
Tip 2 : Try to include interviewer in discussion

4. DBMS

Describe all the joins in SQL with a Venn diagram.

Problem approach

Tip 1 : Draw the diagram and explain logic.

5. Is node present?

Easy
10m average time
98% success
0/40
Asked in companies
Tata Consultancy Services (TCS)Celebal TechnologiesMaersk

For a given Binary Tree of type integer and a number X, find whether a node exists in the tree with data X or not.

Problem approach

1. Start from the root.
2. Compare the searching element with root, if less than root, then recurse for left, else recurse for right.
3. If the element to search is found anywhere, return true, else return false.

Try solving now

6. Shortest path in an unweighted graph

Moderate
25m average time
70% success
0/80
Asked in companies
Goldman SachsSamsung R&D InstituteGoogle

The city of Ninjaland is analogous to the unweighted graph. The city has ‘N’ houses numbered from 1 to ‘N’ respectively and are connected by M bidirectional roads. If a road is connecting two houses ‘X’ and ‘Y’ which means you can go from ‘X’ to ‘Y’ or ‘Y’ to ‘X’. It is guaranteed that you can reach any house from any other house via some combination of roads. Two houses are directly connected by at max one road.

A path between house ‘S’ to house ‘T’ is defined as a sequence of vertices from ‘S’ to ‘T’. Where starting house is ‘S’ and the ending house is ‘T’ and there is a road connecting two consecutive houses. Basically, the path looks like this: (S , h1 , h2 , h3 , ... T). you have to find the shortest path from ‘S’ to ‘T’.

For example
In the below map of Ninjaland let say you want to go from S=1 to T=8, the shortest path is (1, 3, 8). You can also go from S=1 to T=8  via (1, 2, 5, 8)  or (1, 4, 6, 7, 8) but these paths are not shortest.

altImage

Problem approach

Initially all vertex are unvisited so visited[i] will be false for all i and as no path is yet constructed so distance[i] will be infinity or you can take any value like -1 and set predecessor[i] as -1 for all i.

Now the first vertex to be visited is sourse and distace of Source to source is 0 hence visited[source] = true
distance[source]=0.
queue.push(source).

while there are vertices in the queue:
1.Read a vertex u from the queue
2.For all adjacent vertices of u :
if visited[adj[u][i] ] is false (where adj is a vector containing adjascency list)
- make it true
put distance [adj[u][i]]=distance[i]+1
predecessor[adj[u][i]]=u

queue.push(adj[[u][i]])

if(adj[u][i]==destination then return true so we get distance of vertex i from source vertex from distance array and immediate predecessor of vertex i from predecessor array we get length of path from source to any vertex in O(1) time from distance array and printing path from source to any vertex we use predecessor array which takes O(V) time in worst case
thus complexity of the algorithm is O(V+E) with Auxiliary space O(V).

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

What is inheritance in C++?

Choose another skill to practice
Start a Discussion
Similar interview experiences
Data Scientist
3 rounds | 2 problems
Interviewed by Maersk
1015 views
0 comments
0 upvotes
SDE - 1
3 rounds | 3 problems
Interviewed by Maersk
948 views
0 comments
0 upvotes
SDE - Intern
3 rounds | 3 problems
Interviewed by Maersk
1075 views
0 comments
0 upvotes
Product Engineer
3 rounds | 5 problems
Interviewed by Squadstack
1505 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
104887 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
49901 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
31105 views
6 comments
0 upvotes