Maximum Path Sum
Lesson 13 of 13 in Coddy's Binary Tree - Data Structures Series #3 course.
The next challenges use the BinaryTree you built. Use the provided implementation to solve them.
Challenge
EasyWrite a function named getMaxPath that gets a string representing a BinaryTree and returns the maximum sum of values along any path from the root to a leaf (or any descendant).
Try it yourself
#include <stdio.h>
#include <string.h>
#include "solution.h"
int main() {
char s[4096];
if (!fgets(s, sizeof(s), stdin)) s[0] = '\0';
s[strcspn(s, "\r\n")] = '\0';
printf("%d\n", getMaxPath(s));
return 0;
}