Entering edit mode

Round started with my introduction and my past experience, about my projects.

There were many questions asked related to my projects and tech stack involved.

After this, I was asked about oops concept in Java.

Few general questions on java.

I was given 2 snippets (Java) to predict the output.

General question why this is the output, What can we change to get a different output.

At last I was given a coding ques, which goes a follows -

**Question**

Click here to Practice

Submit Problem to OJ

Integer array as input, Count the unique digit from the array.

Using those digits make the largest number possible.

Sample input - 1,11,33,98,58,88

Unique digits - 1,3,5,8,9

Sample output - 98531 (Largest Number)

Questions regarding code re-usability were asked.

No logical reasoning ques were asked for now.

Entering edit mode

- Find all the unique digits in the array and form the largest number possible using those digits.

Store the frequency of all the digits and then form the largest number using the digits having a frequency of more than 1.

For example, for the array

`[1, 11, 33, 98, 58, 88]`

the frequency array will be`freq[10]={0,3,0,2,0,1,0,0,4,1}`

. So the largest number will be`98531`

.

Time Complexity: `O(N), N`

is the size of the array.

Loading Similar Posts