Computer Science, asked by Vivekraj883, 19 days ago

Special integer in array in java

Answers

Answered by Jiya0071
0

Explanation:

An array is special if it contains special elements. A special element is an element which can be represented by the sum of two numbers where one number is reverse of other. Like Array is {22, 121} . Here 22 = 11 + 11 and 121 = 92 + 29.

Answered by Jasleen0599
0

Special integer in array in java.

  • In Java, special numbers are those whose factorial sums equal the number itself. It may be a number with N digits. The number must first be divided into its corresponding digits, with their factorials being computed by the programme. Following that, you should add the total of each determined factorial.
  • Each number in the array of numerous numbers appears three times, with the exception of one unusual number that only appears once. How can I locate the special number in the array, please?
  • Right now, the only approaches I can suggest use radix sorting and quick sorting and cannot benefit from the question's inherent characteristic. I therefore require some new algorithms.
  • If the array is sorted, solving the issue is simple; you just loop through the list three items at a time and determine whether the third item is identical to the one you are currently checking.
  • If the array is not sorted, a hash table can be used to count how many times each number appears.
  • When the factorial sum of a number's digits equals the number itself, such number is considered to be a special number. 145, for instance, is a special number since 1!+4!+5!=145.

#SPJ2

Similar questions