Add office photos
Dunzo logo
Engaged Employer

Dunzo

Verified
3.4
based on 743 Reviews
Video summary
Filter interviews by
SDE-2
Experienced
Clear (1)

Dunzo SDE-2 Interview Questions and Answers

Updated 5 Feb 2024

Q1. Container with Most Water Problem Statement

Given a sequence of 'N' space-separated non-negative integers A[1], A[2], ..., A[i], ..., A[n], where each number in the sequence represents the height of a line draw...read more

Ans.

Find two lines to form a container with maximum water area on a Cartesian plane.

  • Iterate through the array from both ends to find the maximum area.

  • Calculate the area using the formula: (min(height[left], height[right]) * (right - left)).

  • Update the pointers based on the height of the lines to maximize the area.

Add your answer
right arrow

Q2. Number of Subsequences with Even and Odd Sum

Your task is to determine the number of subsequences with odd sums and the number of subsequences with even sums from a given array of positive integers. As resultin...read more

Ans.

Count the number of subsequences with odd and even sums in a given array of positive integers modulo 10^9 + 7.

  • Use dynamic programming to keep track of the count of subsequences with odd and even sums.

  • Consider the parity of each element in the array to determine the count of subsequences with odd and even sums.

  • Apply modulo 10^9 + 7 to handle large resulting numbers.

  • Example: For input [1, 2, 3], there are 3 subsequences with odd sums and 4 subsequences with even sums.

Add your answer
right arrow

Q3. Minimum Cost to Reduce Array Problem Statement

You are given an array ARR containing N positive integers. Your task is to reduce the size of this array to 1 by repetitively merging adjacent elements. Each time ...read more

Ans.

Find the minimum cost to reduce an array to a single element by merging adjacent elements with their sum.

  • Iteratively merge adjacent elements to minimize total cost

  • Choose pairs to merge strategically to reduce cost

  • Calculate sum of adjacent elements and update array size

Add your answer
right arrow

Q4. Maximum Size Rectangle Binary Sub-Matrix with All 1s

Given a binary-valued matrix of size N x M, your task is to determine the largest area of a submatrix that contains only 1's.

Input:

The first line contains ...read more
Ans.

Find the largest area of a submatrix containing only 1's in a binary matrix.

  • Iterate over each cell in the matrix and calculate the maximum area of submatrix with all 1's ending at that cell.

  • Use dynamic programming to keep track of the maximum area ending at each cell.

  • Update the maximum area as you iterate through the matrix.

  • Return the overall maximum area found in the matrix.

Add your answer
right arrow
Discover Dunzo interview dos and don'ts from real experiences

Q5. Anagram Substring Search

Given two strings 'STR' and 'PTR', identify all starting indices of 'PTR' anagram substrings in 'STR'. Two strings are anagrams if one can be rearranged to form the other.

Input:

First ...read more
Ans.

Identify starting indices of anagram substrings of 'PTR' in 'STR'.

  • Use a sliding window approach to check for anagrams of 'PTR' in 'STR'.

  • Create a frequency map of characters in 'PTR' and 'STR' to compare.

  • Slide the window along 'STR' and check if the frequency maps match.

  • Return the starting indices where anagrams are found.

Add your answer
right arrow

Q6. Next Greater Element Problem Statement

You are given an array arr of length N. For each element in the array, find the next greater element (NGE) that appears to the right. If there is no such greater element, ...read more

Ans.

The task is to find the next greater element for each element in an array to its right, if no greater element exists return -1.

  • Use a stack to keep track of elements for which the next greater element is not found yet.

  • Iterate through the array from right to left, popping elements from the stack until a greater element is found.

  • Store the next greater element for each element in a separate array.

Add your answer
right arrow
Contribute & help others!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top SDE-2 Interview Questions from Similar Companies

Amazon Logo
4.1
 • 39 Interview Questions
Walmart Logo
3.7
 • 19 Interview Questions
Microsoft Corporation Logo
4.0
 • 16 Interview Questions
PayPal Logo
3.9
 • 14 Interview Questions
View all
Recently Viewed
DESIGNATION
LIST OF COMPANIES
AIRBUS
Locations
SALARIES
BARC
SALARIES
AVIN Systems
SALARIES
JUSPAY
INTERVIEWS
Tata 1mg
No Interviews
REVIEWS
Toshiba Software India
No Reviews
REVIEWS
Tata Play
No Reviews
LIST OF COMPANIES
comScore
Locations
INTERVIEWS
Dunzo
No Interviews
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter