Find only one occurrence of the number of public class getnumone{//Get only one occurrence of the number of public static int onecenum (Int[]arr,int k) in an array where the other numbers appear K
{int[]e0=new int[32];
for (int i=0;i<arr.length;i++) {setcurexc (e0,arr[i],k);
Converts the number of//k into decimal int cur=getnumfromknum (E0,K);
System.out.println ();
return cur; //Get the intermediate steps to get only one occurrence of the K-number public static void Setcurexc (Int[]e0,int value,int k) {int[]res=g
Etknumfromnum (VALUE,K);
for (int i=0;i<e0.length;i++) {e0[i]= (e0[i]+res[i])%k;
Converts a decimal integer to a K-binary number public static int[] Getknumfromnum (int value,int k)
{int[]res=new int[32];
int index=0;
while (value!=0) {res[index++]=value%k;
value=value/k;
return res;
A decimal integer that converts the number of K intopublic static int Getnumfromknum (Int[]e0,int k) {int res=0;
for (int i=e0.length-1;i>=0;i--) {res=res*k+e0[i];
return res;
public static void Main (String []args) {//system.out.println ("Hello");
int[]arr={1,1,1,2,2,2,3}; int k=3;
K indicates the number of times the other number appears System.out.println (Onecenum (arr,k)); }
}