Get Off-Campus Placement Jobs Info !!!
Programs asked in Mettl Coding Round
Click To Practce List of Programs asked in Nagarro !!!

# Array Programs in JAVA

11 / 23

Find the 2nd largest element in array, without sorting and swap in the middle element.

Input : NA

Output : NA

|  Array | | | |  Fresher

12 / 23

Given a list of the array, sort the array in descending order with the frequency of elements.

Input : [2, 5, 6, 2, 3, 5, 5]

Output :

|  Array | | | |  Fresher

Tags:Accenture

13 / 23

Write a program to sort a 2-D matrix row by row in ascending order.

Input : NA

Output : NA

|  Array | | | |  Fresher

Tags:Accenture

14 / 23

Given an array of size MxN and coordinates of starting of subarray (x, y). You need to rotate that subarray and then print the full array after rotation.

Input : NA

Output : NA

|  Array | | | |  Fresher

Tags:Nagarro

15 / 23

Given three sorted arrays A, B, and C. Write the most efficient algorithm to find the 5th largest element among the three arrays.

Input : NA

Output : NA

|  Array | | | |  Fresher

Tags:Nagarro

16 / 23

Given two vectors. One contains array element "ele" and other indexes "ind" to push the corresponding element at that index in new array shifting all elements to its right.

Example:
Intput:
ele = {0, 1, 2, 3, 4} ind ={0, 1, 2, 1, 2}

Output: {0, 3, 4, 1, 2}

Input : ele: {0, 1, 2} ind: {0, 1, 0}

Output :

|  Array | | | |  Fresher

Tags:SAP Labs

17 / 23

Given an array with n elements and a sum x, need to count all pairs of elements in the array whose sum is equal to x. Told two approaches one using binary search and other using two pointers.

Input : NA

Output : NA

|  Array | | | |  Fresher

Tags:SAP Labs

18 / 23

Given an array and integer K, find the number of pairs such that a[i]+K=a[j]

Input : NA

Output : NA

|  Array | | | |  Fresher

Tags:SAP Labs

19 / 23

Given an array of integers with repeating elements, find the sum of differences between positions of repeated elements and store them in an array of the same size.

For e.g. given array {1, 2, 3, 1, 2, 1, 2} we shall have:
For position 0: 1 is on positions 3&5 additional to position 0.
Thus for position 0: |3-0| + |5-0| = 8.
For position 1: 2 is on positions 4&6 additional to position 1.
Thus for position 1: |4-1| + |6-1| = 8.

Input : NA

Output : NA

|  Array | | | |  Experience, Fresher

20 / 23

Finding palindromic substrings within a string

For e.g. given string ‘banana’, palindromic substrings would be ‘aa’, ‘aaa’, ‘ana’, ‘anna’ and so on.

Input : NA

Output : NA

|  Array | | | |  Experience, Fresher

+ Contribute Programming Qs.

Baig
1