Dunzo Coding Questions and Answers
Coding Questions asked in Dunzo with Solutions
Your understanding of the coding portion of the Dunzo recruitment campaign will be aided by the Dunzo Coding Questions and Answers on this page. It is an elimination round and has a significant weight.
Learn everything on this page concerning Dunzo hiring practises and coding inquiries. You’ll learn in-depth details about the Dunzo Recruiting Process, Eligibility Requirements, and Pay Structure.
About Dunzo
Team Dunzo is passionate about using technology to improve the accessibility and convenience of the communities where theywere raised. They’re passionate about what matters to you, whether that’s giving our users back time to do the things they love, giving our partners flexible earning possibilities, or growing the businesses of their merchants.
Recruitment Process at Dunzo
Below is a detailed description of the hiring procedure for the position of Software Engineer- Backend INTERN at Dunzo.
- Online Coding
- Problem Solving Data Structures 1
- Problem Solving Data Structures 2/ Live Coding
- Culture Fitment
We have even tabulated some more information for your reference and understanding.
Bosch Global Software Technologies | Related Information |
---|---|
Batch | 2023 |
Course | B.Tech CSE IT ECE |
Role | Software Engineer- Backend Intern |
Type of Hiring | Internship |
Internship Duration | 6 months |
Platform | HackerRank |
Stipend | INR 50K/- |
Required Skills | Python/Django, Go, Nodejs, Postgres, Mongo, Spark, Elastic-Search, Redis, Kafka, Kubernetes |
Prime Course Trailer
Related Banners
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
Dunzo Coding Questions and Answers
Question 1 : Minimum Occurrence (R->Medium)
Problem Statement :
Given a sting , return the character that appears the minimum number of times in the string. The string will contain only ascii characters, from the ranges (“a”-”z”,”A”-”Z”,0-9), and case matters . If there is a tie in the minimum number of times a character appears in the string return the character that appears first in the string.
Input Format :
Single line with no space denoting the input string.
Output Format :
Single character denoting the least frequent character.
Constraints :
Length of string <=10^6
Sample Input :
cdadcda
Sample Output :
c
Explanation :
C and A both are with minimum frequency. So c is the answer because it comes first with less index.
#include <bits/stdc++.h> using namespace std; unordered_map < char, int > F; int main() { string s; int m = INT_MAX; cin >> s; for (auto i: s) F[i]++; for (auto i: F) m = min(m, i.second); for (auto i: s) if (F[i] == m) { cout << i; break; } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.next(); char arr[] = str.toCharArray(); int temp[] = new int[256]; for (int i = 0; i < arr.length; i++) { temp[arr[i]]++; } int min = Integer.MAX_VALUE; int index = 0; for (int i = 255; i >= 0; i--) { if (temp[i] == 0) continue; min = Math.min(min, temp[i]); } for (int i = 0; i < arr.length; i++) { if (min == temp[arr[i]]) { System.out.println(arr[i]); break; } } } }
s = input() ans = [] for i in s: ans.append(s.count(i)) print(s[ans.index(min(ans))])
Question 2 :Duplicates
Problem Statement :
The principal has a problem with repetitions. Everytime someone sends the same email twice he becomes angry and starts yelling. His personal assistant filters the mails so that all the unique mails are sent only once, and if there is someone sending the same mail again and again, he deletes them. Write a program which will see the list of roll numbers of the student and find how many emails are to be deleted.
Sample Input:
6
1
3
3
4
3
3
Sample Output:
3
#include <bits/stdc++.h> using namespace std; map < int, int > m; int main() { int n, a, ans = 0; cin >> n; while (n--) { cin >> a; m[a]++; if (m[a] > 1) ans++; } cout << ans; }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); TreeSet < Integer > list = new TreeSet < > (); for (int i = 0; i < n; i++) list.add(sc.nextInt()); System.out.println(Math.abs(n - list.size())); } }
def countDuplicate(numbers): c = 0 for i in set(numbers): if numbers.count(i) > 1: c += numbers.count(i) - 1 return c n = int(input()) numbers = [] for i in range(n): numbers.append(int(input())) print(countDuplicate(numbers))
Question 3 : Last student’s ID (R->Medium+)
Problem Statement :
There is an id code that is supposed to be given to all the aspirants of an exam. It is actually a substring of a given string. That means, the authority takes a string and then assigns all the unique substrings to all the students. Suppose there is a string “abcde”, so the ids of the students will be “a”,”b”,”c”,”d”,”e”,’ab”,”abc”,”abcd”,”abcde”,”bc”,”bcd”,”bcde”,”cd”,”cde”,”de”.
The students are standing in a line according to the lexicographic order of their given ids. You have to find out the id of the last student for the given input string from which the ids are generated.
Input Format:
Single line with the id generating string
Output format:
The last id as per lexicographical order
Constraints:
Number of characters in the string<=10^9
Sample Input:
abdc
Sample output:
dc
Explanation:
The last student will be with the id dc. The order will be
abdc
a
ab
abd
abdc
b
bd
bdc
c
d
dc
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; vector < string > v; for (int i = 0; i < s.length(); i++) { v.push_back(s.substr(i, s.length() - i)); //cout<()); cout << v[0]; }
import java.util.*; public class Main { public static String maxString(char set[]) { int n = set.length; String temp = ""; TreeSet < String > list = new TreeSet < > (); for (int i = 0; i < n; i++) { temp = ""; for (int j = i; j < n; j++) { temp = temp + set[j]; list.add(temp); } } return list.last(); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.next(); char arr[] = str.toCharArray(); System.out.println(maxString(arr)); } }
s = input() j = 1 c = 0 while j < len(s): if ord(s[c]) < ord(s[j]): c = j j += 1 print(s[c:])
Question 4 : Array Subarray
Problem Statement :
You are given an array, You have to choose a contiguous subarray of length ‘k’, and find the minimum of that segment, return the maximum of those minimums.
Sample input 0 :
1 → Length of segment x =1
5 → size of space n = 5
1 → space = [ 1,2,3,1,2]
2
3
1
2
Sample output :
3
Explanation :
The subarrays of size x = 1 are [1],[2],[3],[1], and [2],Because each subarray only contains 1 element, each value is minimal with respect to the subarray it is in. The maximum of these values is 3. Therefore, the answer is 3
#include <bits/stdc++.h> using namespace std; vector < int > arr; int prevmin = -1; int flag = 0; int x, n, q; int sorting(int start, int end) { if (start + 1 == n) { start = 0; end = end - n; } if (start == end) return arr[start]; return min(arr[start], sorting(start + 1, end)); } int func(int start, int end) { if (flag == 0) { flag++; return prevmin = sorting(start, end); } if (arr[start - 1] == prevmin) return prevmin; return prevmin = (arr[end] <= prevmin) ? prevmin : sorting(start, end); } int main() { cin >> x >> n; int ans = 0; for (int i = 0; i < n; i++) { cin >> q; arr.push_back(q); } for (int i = 0; i < n; i++) { ans = max(ans, func(i, i + x - 1)); } cout << ans; }
import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int n = sc.nextInt(); int arr[] = new int[n]; for (int i = 0; i < n; i++) arr[i] = sc.nextInt(); int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; for (int i = 0; i <= n - x; i++) { min = Integer.MAX_VALUE; for (int j = i; j < (i + x); j++) min = Math.min(min, arr[j]); max = Math.max(min, max); } System.out.println(max); } }
s = int(input()) n = int(input()) a = [] for i in range(n): a.append(int(input())) def min_in_segment(start, end, prev, s, prev_min): if s == 1: return a[start] else: if prev == -1 or prev_min == -2: return min(a[start : end + 1]) elif prev_min != -2: if prev != prev_min: if a[end] < prev_min: return a[end] else: return prev_min else: return min(a[start : end + 1]) msf = -1 prev = -1 prev_min = -2 for i in range(n - s + 1): new_min = min_in_segment(i, i + s - 1, prev, s, prev_min) msf = max(msf, new_min) prev = a[i] prev_min = new_min print(msf)
Question 5 : Coin Game (R->Medium)
Problem Statement :
Raman was playing a game, he starts with x coins. Now in every step, he wins and loses and he has to get the money or pay the money as needed. He came in contact with a psychic who can see the future and the Psychic predicted the outcomes after each step. Now Raman wants to start the game with the minimum wage where he doesn’t run out of money. Help Raman to find what money he should start with. The only rule to keep playing is not going in a credit situation.
Input Format:
First line with n, number of steps in the game
Next n lines, n integers denoting outcomes of every game. Positive means winning and negative means losing that money.
Output Format:
One single integer denoting the minimum amount to start with
Constraints:
Number of steps<=10^9
-1000<=Money needed in each step<=1000
Sample Input:
4
2
-9
15
2
Sample Output:
7
Explanation:
If he starts with 7 rupees, then after steps : 7 ->9 -> 0-> 15 -> 17.
#include <iostream> using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; int sum = 0, ans = 0; for (int i = 0; i < n; i++) { sum += a[i]; if (sum < 1) { sum = -sum; ans += sum; sum = 0; } } cout << ans << endl; }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int arr[] = new int[n]; for (int i = 0; i < n; i++) arr[i] = sc.nextInt(); int sum = 0, ans = 0; for (int i = 0; i < n; i++) { sum += arr[i]; if (sum < 1) { sum = -sum; ans += sum + 1; sum = 1; } } System.out.println(ans); } }
n = int(input()) arr = [] for i in range(n): arr.append(int(input())) s, a = 0, 0 for i in arr: s = s + i if s < 1: a = a + (-1 * s) s = 0 print(a)
FAQs on Dunzo Coding Questions with Solutions
Question 1: What type of coding questions are asked in Dunzo?
Dunzo asks moderate to high level questions in their placement exam. This includes questions on DSA and competitive coding.
Question 2: Is the Dunzo exam difficult?
Dunzo exam is tough to crack as the questions asked are of an advanced level. Therefore, without proper practice and knowledge you cannot clear this exam.
Get over 200+ course One Subscription
Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others
Login/Signup to comment