int comp(const void *a, const void *b)
{
return *(int *)b - *(int *)a;
}
int nextGreaterElement(int n){
int nLen = 0;
int n_copy = n;
while(n_copy)
{
nLen++;
n_copy /= 10;
}
n_copy = n;
int *nStr = (int *)malloc(sizeof(int) * nLen);
int *nExt = (int *)malloc(sizeof(int) * nLen);
memset(nStr, 0, sizeof(int) * nLen);
memset(nExt, -1, sizeof(int) * nLen);
int i, j;
for(i = 0; i 2147483647) return -1;
return result;
}



