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

SDE - 1

Dunzo
upvote
share-icon
2 rounds | 3 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 Months
Topics: Data Structures like Trees, Linked Lists, Binary Search, DP, Graphs,OOPS, OS, DBMS
Tip
Tip

Tip 1 : Read last year interview experiences of the company you apply for.
Tip 2 : In the last 2-3 days before your interview, just revise your concepts and problems.

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

Tip 1 : Keep it simple and clean. Don't make it flashy. 
Tip 2 : Highlight your experiences and projects.

Interview rounds

01
Round
Medium
Video Call
Duration60 Minutes
Interview date13 Jan 2022
Coding problem2

It was strictly a DSA round where 2 coding problems asked from me.

1. Distance Of Nearest Cell Having 1 In A Binary Matrix

Moderate
35m average time
65% success
0/80
Asked in companies
FacebookDunzoCIS - Cyber Infrastructure

You have been given a binary matrix 'MAT' containing only 0’s and 1’s of size N x M. You need to find the distance of the nearest cell having 1 in the matrix for each cell.

The distance is calculated as |i1 – i2| + |j1 – j2|, where i1, j1 are the coordinates of the current cell and i2, j2 are the coordinates of the nearest cell having value 1.
Note :
You can only move in four directions which are : Up, Down, Left and Right.
For example :
If N = 3, M = 4

and mat[ ][ ] = { 0, 0, 0, 1,
                  0, 0, 1, 1,
                  0, 1, 1, 0 }

then the output matrix will be

3  2  1  0
2  1  0  0
1  0  0  1
Problem approach

The better approach is to do a BFS starting from all the 1s in the given matrix. The distance of all the 1s is zero and for all the adjacent the minimum distance is one more than this.

Create a queue of Coordinates, that is used to store the (row, column) of an element. Create an array ans of size same as array matrix.
Traverse through all the elements of the matrix and push the coordinates of elements that are 1 into the queue.
Initialize a variable minDistance as 0. While queue is not empty repeat steps 4 and 5.
Initialize a variable size as size of the queue. Run a loop for i equals 0 to size(not included). At every iteration pop out an element from the queue. Set ans[row][col] as minDistance, and enqueue all the valid adjacents of this element that are 0 in the matrix array and set them as 1 in the matrix array.
Increment minDistance.
Print the ans array.

Try solving now

2. Arithmetic Subarrays

Easy
20m average time
80% success
0/40
Asked in companies
HCL TechnologiesDunzoAmazon

You are given an array ‘A’ of length ‘N’, you have to tell the number of arithmetic subarrays that exist in the array ‘A’.

An Arithmetic subarray is a subarray that has 3 or more elements and the difference between consecutive elements is the same. Eg: [1, 3, 5, 7] has a length of 4, and diff between any two consecutive elements is 2.

Note:
A subarray is a slice from a contiguous array (i.e., occupy consecutive positions) and inherently maintains the order of elements.
Problem approach

We use a vector of unordered_maps for our dynamic programming.
The vector is used as follows: [ index, {diff, count} ].
For each index, we have all common differences and count arithmetic slices up to that index.

We iterate through the given vector nums, and for each number we iterate again from the beginning to there.
diff is the difference, so we can add 1 to the counter of dp[i][diff].
If we already have a key for diff in dp[j], we can add to dp[i][diff] all the count that we had by dp[j][diff]. And that's what we add to our res.

Try solving now
02
Round
Medium
Video Call
Duration60 Minutes
Interview date18 Jan 2022
Coding problem1

Again it was a DSA round.

1. Maximum Coins

Hard
16m average time
78% success
0/120
Asked in companies
DunzoProtiumGoldman Sachs

You are given a two-dimensional matrix of integers of dimensions N*M, where each cell represents the number of coins in that cell. Alice and Bob have to collect the maximum number of coins. The followings are the conditions to collect coins:

Alice starts from top left corner, i.e., (0, 0) and should reach left bottom corner, i.e., (N-1, 0). Bob starts from top right corner, i.e., (0, M-1) and should reach bottom right corner, i.e., (N-1, M-1).

From a point (i, j), Alice and Bob can move to (i+1, j+1) or (i+1, j-1) or (i+1, j)

They have to collect all the coins that are present at a cell. If Alice has already collected coins of a cell, then Bob gets no coins if goes through that cell again.

For example :
If the matrix is 
0 2 4 1
4 8 3 7
2 3 6 2
9 7 8 3
1 5 9 4

Then answer is 47. As, Alice will collect coins 0+8+3+9+1 = 21 coins. Bob will collect coins 1+7+6+8+4 = 26 coins. Total coins is 21+26 = 47 coins.
Problem approach

Since we want to maximum the value we can get, and we always get the middle value of three selection.
We can first sort piles and take 3 coins [Li, Mi, Hi] in following manners.

n=9
piles = [L1,L2,L3,M2,H3,M2,H3]

As this kind of greedy approach, we can maximize the number of coins we can have.

time: O(nlogn)
space: O(1)

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

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
3 rounds | 5 problems
Interviewed by Dunzo
4463 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 6 problems
Interviewed by Dunzo
762 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Dunzo
702 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 5 problems
Interviewed by Dunzo
790 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
114579 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
34961 views
7 comments
0 upvotes