Dsa
Trees
Warm-up
Find Maximum Value in Binary Tree
Given a binary tree, find the maximum value among all nodes. A tree node is defined using a Node class with properties 'value', 'left', and 'right'. Write a function that reads the level-order traversal of the tree from input and prints the maximum node value.
Input format:
A single line of integers representing the level-order traversal of the tree (0 represents a null node).
Output format:
A single integer representing the maximum value in the tree.
Example:
Input:
1 5 3 0 7 2 0 0 0 0 0
Output:
7
Key concepts
treesmax-findingiterative
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now