[0_1494145965853_J6VIT6U(4~T8BWH15)YE]EC.png](/uploads/files/1494145963803-j6vit6u-4-t8bwh15-ye-ec.png)

code :

/**

- Definition for a binary tree node.
- struct TreeNode {
`int val;`

`struct TreeNode *left;`

`struct TreeNode *right;`

- };

/root)

int A[1000000];

int length=0;

int travel(struct TreeNode

{

if(root->left!=NULL)

{

travel(root->left);

}

A[length]=root->val;

length++;

if(root->right!=NULL)

{

travel(root->right);

}

return 0;

}

int getMinimumDifference(struct TreeNode* root) {

travel(root);

int min=abs(A[0]-A[1]);

for(int i=1;i<length-1;i++)

{

if(min>abs(A[i]-A[i+1]))

{

min=abs(A[i]-A[i+1]);

}

}

return min;

}