/**
 Definition for a binary tree node.
 function TreeNode(val) {

this.val = val;

this.left = this.right = null;
 }
/
/*  @param {TreeNode} root
 @return {number}
*/
var arr = [];
var getMinimumDifference = function(root) {
mid(root);
let min = Number.MAX_VALUE;
for(let i = 1; i < arr.length; i++){
let diff = Math.abs(arr[i]  arr[i1]);
if(min > diff){
min = diff;
}
}
return min;
};
var mid = function(root){
if(root != null){
mid(root.left);
arr.push(root.val);
mid(root.right);
}
}
Run Code is no problem, but is Submit Solution is failed