DotPe interview experience Real time questions & tips from candidates to crack your interview

SDE - 1

DotPe
upvote
share-icon
3 rounds | 8 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 1 month
Topics: Data structures & algorithms, Articles & concepts from GeeksforGeeks, Coding from Leetcode, Timed Coding: Interviewbit
Tip
Tip

Tip 1 : Always try to think from the basic solutions, but in timed interviews, give out the most optimized approach
Tip 2 : Practice atleast 20-25 questions from each Data structure
Tip 3 : Be clear & through about your work Experience

Application process
Where: Other
Eligibility: NA
Resume Tip
Resume tip

Tip 1 : Keep it 1 pager
Tip 2 : Try to highlight the main words in bold & keep the details short & crisp

Interview rounds

01
Round
Medium
Video Call
Duration60 Minutes
Interview date18 Aug 2020
Coding problem4

This was a technical round to check my technical acumen.
My past projects were discussed along with my work experience at my previous company.
3 Coding questions, 1 puzzle & tech-logic question.

1. Reverse a Sublist of Linked List

Easy
10m average time
90% success
0/40
Asked in companies
HSBCFacebookLiberin Technologies

You are given a linked list of 'N' nodes. Your task is to reverse the linked list from position 'X' to 'Y'.

For example:
Assuming, the linked list is 10 -> 20 -> 30 -> 40 -> 50 -> 60 -> NULL. X = 2 and Y = 5. On reversing the given linked list from position 2 to 5, we get 10 -> 50 -> 40 -> 30 -> 20 -> 60 -> NULL.
Problem approach

My solution used the idea to reverse a normal linked list.
1. Get the pointer to the head and tail of the reversed linked list.
2. Get the pointer to the node before mth and node after nth node.
3. Reverse the list
4. Connect back the links properly.

Try solving now

2. Populating Next Right Pointers In Each Node

Moderate
25m average time
75% success
0/80
Asked in companies
AmazonMathworksMorgan Stanley

You have been given a complete binary tree of ‘N’ nodes. The nodes are numbered 1 to ‘N’.

You need to find the ‘next’ node that is immediately right in the level order form for each node in the given tree.

Note :

1. A complete binary tree is a binary tree in which nodes at all levels except the last level have two children and nodes at the last level have 0 children.
2. Node ‘U’ is said to be the next node of ‘V’ if and only if  ‘U’ is just next to ‘V’ in tree representation.
3. Particularly root node and rightmost nodes have ‘next’ node equal to ‘Null’ 
4. Each node of the binary tree has three-pointers, ‘left’, ‘right’, and ‘next’. Here ‘left’ and ‘right’ are the children of node and ‘next’ is one extra pointer that we need to update.

For Example :

1

The‘next’ node for ‘1’ is ‘Null’, ‘2’ has ‘next’ node ‘6’, ‘5’ has ‘next’ node ‘3’, For the rest of the nodes check below.

1

Problem approach

I used nested loops.
The outer loop, goes through all the levels and the inner loop goes through all the nodes at every level.

Try solving now

3. Minimum insertions to make a string palindrome

Moderate
30m average time
70% success
0/80
Asked in companies
FacebookAppleSamsung

A palindrome string is one that reads the same backward as well as forward.


You are given a string 'str'.


Find the minimum number of characters needed to insert in 'str' to make it a palindromic string.


Example :
Input: 'str' = "abca"

Output: 1

Explanation:
If we insert the character ‘b’ after ‘c’, we get the string "abcba", which is a palindromic string. Please note that there are also other ways possible.


Problem approach

Find out the LCS of string and its reverse.
This will give you how many maximum characters can form a palindrome & then insert the remaining characters using the following steps. 
1. Find the length of LCS of the input string and its reverse. Let the length be ‘l’.
2. The minimum number of insertions needed is the length of the input string minus ‘l’.

Try solving now

4. Puzzle

There are 4 persons (A, B, C and D) who want to cross a bridge in night.

A takes 1 minute to cross the bridge.
B takes 2 minutes to cross the bridge.
C takes 5 minutes to cross the bridge.
D takes 8 minutes to cross the bridge.
There is only one torch with them and the bridge cannot be crossed without the torch. There cannot be more than two persons on the bridge at any time, and when two people cross the bridge together, they must move at the slower person's pace. Can they all cross the bridge in 15 minutes?

Problem approach

Step 1 : A and B cross the bridge. A comes back. Time taken 3 minutes. Now B is on the other side.
Step 2 : C and D cross the bridge. B comes back. Time taken 8 + 2 = 10 minutes. Now C and D are on the other side.
Step 3 : A and B cross the bridge. Time taken is 2 minutes. All are on the other side.
Total time spent: 3 + 10 + 2 = 15 minutes.

02
Round
Medium
Video Call
Duration60 Minutes
Interview date19 Aug 2020
Coding problem2

1 hour coding round via Video-call, majorly did coding questions & discussed work at previous company.
Brief discussions about: DBMS, indexing ways, B Trees, API writing, webD Backend experience

1. Move Zeroes To End

Easy
0/40
Asked in companies
SAP LabsNewgen SoftwareDeloitte

Given an unsorted array of integers, you have to move the array elements in a way such that all the zeroes are transferred to the end, and all the non-zero elements are moved to the front. The non-zero elements must be ordered in their order of appearance.

For example, if the input array is: [0, 1, -2, 3, 4, 0, 5, -27, 9, 0], then the output array must be: [1, -2, 3, 4, 5, -27, 9, 0, 0, 0].

Expected Complexity: Try doing it in O(n) time complexity and O(1) space complexity. Here, ‘n’ is the size of the array.

Problem approach

Use 0 as a pivot element and whenever you see a non zero element, swap it with the pivot element. 
So all the non zero element will come at the beginning.

Try solving now

2. Minimum Jumps

Moderate
25m average time
75% success
0/80
Asked in companies
WalmartDirectiMakeMyTrip

Bob lives with his wife in a city named Berland. Bob is a good husband, so he goes out with his wife every Friday to ‘Arcade’ mall.

‘Arcade’ is a very famous mall in Berland. It has a very unique transportation method between shops. Since the shops in the mall are laying in a straight line, you can jump on a very advanced trampoline from the shop i, and land in any shop between (i) to (i + Arr[i]), where Arr[i] is a constant given for each shop.

There are N shops in the mall, numbered from 0 to N-1. Bob's wife starts her shopping journey from shop 0 and ends it in shop N-1. As the mall is very crowded on Fridays, unfortunately, Bob gets lost from his wife. So he wants to know, what is the minimum number of trampoline jumps from shop 0 he has to make in order to reach shop N-1 and see his wife again. If it is impossible to reach the last shop, return -1.

Try solving now
03
Round
Easy
Video Call
Duration60 Minutes
Interview date28 Aug 2020
Coding problem2

Detailed background discussion
Work at present company, tech stack, contributions to projects, reason to switch
Databases questions like indexing, joins, etc
What all data structures used in ur daily work at samsung 
Cpp and java basics, webd knowledge

1. Zigzag Binary Tree Traversal

Easy
10m average time
90% success
0/40
Asked in companies
Goldman SachsAmazonFlexiEle Consulting Services (FE)

You are given a ‘Binary Tree’.


Return the level-order traversal of the Binary Tree.


Example:
Input: Consider the following Binary Tree:

Example

Output: 
Following is the level-order traversal of the given Binary Tree: [1, 2, 3, 5, 6, 4]


Try solving now

2. Puzzle

9 weights of equal shape and size, 1 has different weight, given a weighing scale, find the min number of ways to find out which weight is the different one

Problem approach

Divide the 9 balls into 3 groups of 3. Compare the weight of two of those groups.

The heavier group should then be obvious, it will either tip the scales, or, if the scales stay balanced, then it is the group you didn't include.

Now, choose 2 balls from this group and compare their weights, and using the same logic as before, the heavier ball will be obvious.

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 recursion?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Amazon
8518 views
0 comments
0 upvotes
company logo
SDE - Intern
1 rounds | 3 problems
Interviewed by Amazon
3319 views
0 comments
0 upvotes
company logo
SDE - 2
4 rounds | 6 problems
Interviewed by Expedia Group
2580 views
0 comments
0 upvotes
Frontend Engineer 2
3 rounds | 6 problems
Interviewed by DotPe
219 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
114578 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
57824 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
34960 views
7 comments
0 upvotes