MCPcopy Create free account
hub / github.com/Tiwarishashwat/InterviewCodes / maxPathSum

Method maxPathSum

TreeMaximumPathSumBinaryTree.java:2–7  ·  view source on GitHub ↗
(TreeNode root)

Source from the content-addressed store, hash-verified

1class Solution {
2 public int maxPathSum(TreeNode root) {
3 int arr[] = new int[1];
4 arr[0] = Integer.MIN_VALUE;
5 maxiPathSum(root,arr);
6 return arr[0];
7 }
8
9 public int maxiPathSum(TreeNode root, int arr[])
10 {

Callers

nothing calls this directly

Calls 1

maxiPathSumMethod · 0.95

Tested by

no test coverage detected