Coding Questions (2021)-, Dunzo, Informatica

Applied using Referral

Contains 3 Coding Questions

  1. Count the number of unique elements in the array. Useful Link

2. Variations of Knapsack Problem

Given a set of items, each with an arbitrary positive weight and a value = 1 or 2 , determine which items to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible.

Find a polynomial algorithm.

3. Given a permutation of numbers from 1 to n, count the number of quadruples indices (i,j,k,l) such that i<j<k<l and A[i]<A[k]<A[j]<A[l].

Having tight constraint, the solution should be less than O(n²)

The first 4 indices satisfy the given condition.


Applied through Linkedin

Contains 5 SQL Advanced query questions

All questions include more than 2 tables, means all query is based on joins

Useful Link to learn Joins


Company visited On-campus

Consisted of 2 sections, one is MCQ Round and the second is coding round.

Section 1: An online test was conducted containing various sections including os, computer network, Java, python, c aptitude, DBMS, logical reasoning. Each and every section was compulsory.

Section 2: 3 Coding Questions

  1. Given an array of n positive integers such that each element of an integer is from 1 to n. Find the lexicographic permutation that can be obtained by replacing a minimum number of elements in the array such that every element of the array occurs exactly once in the entire array. First, print the minimum number of replacements required and then print the final lexicographical array.

Input arr[] = {2, 3, 4, 3, 2}
Output 2
1 3 4 5 2

Useful Link

2. Given a linked list. arrange the linked list in the manner of alternate first and last elements. ( Extra space is not allowed )

Input : 1->2->3->4->5->6->7->8
Output :1->8->2->7->3->6->4->5

Input :10->11->15->13
Output :10->13->11->15

Useful Link

3. Given an array with n elements and an integer k. Divide the array into subarrays, each of them containing k elements.
Input: arr[]={1, 32, 5, 6, 9, 3} and k=2

The subarrays will have elements:
{132}, {56}, {93}.

Now sort these subarrays as {56}, {93}, {132}. Merge this subarray together and display them as the elements of an original array in sorted order

Final output: arr[]={5, 6, 9, 3, 1, 32}



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store