# Dunzo Interview Experience for SDE Intern (On-Campus)

• Difficulty Level : Medium
• Last Updated : 09 Aug, 2021

Online Test: It had 2 questions. Not exactly remember the questions. but first was matrix question and 2nd was something modified knapsack.  I solved 2nd completely and 1st partially.  I got 131/200 marks. I received mail for 1st interview round.

Round 1: It was DSA/Algo round. The interviewer was great and helpful. He asked 2 questions and gave me 1 hour to solve them.

1. Given a string s. Find the lexicographically smallest subsequence of size k.
```Ex  -  s = "satbz" , k = 3
Ans - "abz"```

I first told the brute force solution. Then I told the O(n^2) solution using some recursion. So the interviewer asked me to do in O(n). After sometime he even gave the hint to use stack. Then I told the solution and wrote the code. it was correct.

2. Given a matrix of size MxN consisting of  { L, R, U, B }.

The value ‘L’ represents you can go left from that cell. similarly ‘R’ right, ‘U’ up, and ‘B’ bottom.

You are at the top leftmost cell (1, 1). You can change any cell value to ‘L’, ‘R’, ‘U’, ‘B’. You have to find minimum changes in the matrix so that there exists a path from (1,1) to (m,n) cell.

```Ex-  [ [R , B , L],
[L , B , R],
[R , R , U]]
Ans = 0
As there already exist a path ,
(1,1)->(1,2)->(2,2)->(3,2)->(3,3). ```

There were 3 more test case were given. I told a dp approach and it worked on the given test cases. There was no time left for the code.

I received mail for 2nd interview round.

Round2(DS/Algo): It was also DSA/Algo round.

1. Given a Complete Binary Tree, you have to tell the number of nodes present in it.

Constraints:

1 <= Number of Nodes (‘N’) <= 500000.

You will only be given the pointer to the root node and nothing else!

Problem state: Solve the above in ceil(log(N) * log(N)). Space Complexity can be O(Log(N)) or even O(1).

I solved the above problem in O(log(N) * log(N)) with constant time-space.

Hint: Think of the properties of a complete binary tree.

2. Given an array of n elements. Return the sum of min and max of all the subarrays.
```All the elements are distinct
N = 3
A = [2, 1, 4 ,3]
{1} + {2} + {3} + {1, 2} +
{2, 3} + {1, 2, 3}

= (1 + 1) + (2 + 2) + (3 + 3) +
(1 + 2) + (2 + 3) + (1 + 3) = 24

So, 24 is the required answer.```

I gave the O(n^2) solution and coded it. I told the approach for O(n).

Hint: https://leetcode.com/problems/sum-of-subarray-minimums

Round 3(Tech/Culture): The interviewer asked 1 DSA question.

1. https://www.geeksforgeeks.org/maximum-size-rectangle-binary-sub-matrix-1s/

I told the solution immediately because it is quite a standard problem. So we just talked about my resume and it ended in 15 minutes.

Overall I had a great experience. All the interviewers were really helpful.

I received the call that I am selected.

My Personal Notes arrow_drop_up