Question: Consider an array: `10 2 4 14 1 7`
Traversing the input array for each valid i, I have to find all the elements which are divisible by the i-th element. So, first I have to find all the elements which are greater than the i-th element.

Example output:

```
10 -> null
2 -> 10
4 -> 10
14 -> null
1 -> 14,4,2,10
7 -> 14,10

```

My approach:
I was thinking of creating a binary tree that would perform a log n operation for each valid insertion in an array that would re-construct the binary tree with the minimum element as root, smaller element on the left and greater element on the right. Now I just have to traverse the right sub-tree of the inserted element and check which elements are divisible by the i-th element. This is a very expensive approach but better than brute-force. 

Can anyone help to find an optimal solution that would be more efficient?

Answer: 
you can try this:

```
#include<stdio.h>
#include<string.h>

int main(){

    int i,len,j=0;
    char mainword[100], reverseword[100];

    scanf("%s",mainword);

    len = strlen(mainword);

    for(i=len; i>=0; i--){
        reverseword[j] = mainword[i-1];
        j++;
    }

    reverseword[j] = '\0';

    if(strcmp(reverseword,mainword)==0){
        printf("\nYes");
    }
    else{
        printf("\nNo");
    }
}

```
instead of this:

```
for(i=len; i>=0; i--){
    printf("%c",reverseword[i]);
          // I just need here to save the output without printing it. So, that later I can compare it. 

}

```

you'd better use just this:

```
for( i=0; i<len; i++) {
    reverseword[i] = mainword[len-i-1];
}

```

And it will magically work.