Pergunta de entrevista da empresa Oracle

Write a program to find the numbers which are greater than the given number from an array. Count only distinct numbers.

Respostas da entrevista

Sigiloso

21 de out. de 2016

Initialize empty array.Iterate through each number and check if the number is present in the new array and if the number is present in the new array then remove from the new array otherwise add it in the new array if its greater than the specified number. finally count the size of the new array.

3

Sigiloso

18 de ago. de 2017

create a set for distinct numbers. sort it.and iterate set, add the elements in new array, until you get the given number.