There are some test cases that are expecting incorrect output values. Namely, one with 6 val>26 nodes connected at the top of the tree (and thus 5 connecting branches) expects 4.
test cases incorrect

for those interested,
This is my code
int longestUnivaluePath(TreeNode* root) { if(root==NULL) return 0; int path = 0; helper(root, path, 0); return path; } int helper(TreeNode * root, int &path, int curr){ //bottom of tree up if(root==NULL) return 0; int l = helper(root>left, path,curr); int r = helper(root>right, path,curr); if(root>left){ if(root>left>val==root>val) l++; else l = 0; } if(root>right){ if(root>right>val==root>val) r++; else r = 0; } curr = l + r; path = max(path,curr); return curr; }