Maximum Value in a Binary Tree
Updated
Problem statement
Given the root of a nonempty binary tree, return the maximum value stored in any node.
Your implementation must handle trees whose values are all negative.
Function
findMaximumValue(root: TreeNode) → intExamples
Example 1
root = [3,1,5,null,2,4,8]return = 8The largest node value is 8.
Example 2
root = [-8,-12,-3]return = -3All values are negative, so the least negative value is the maximum.
Constraints
- The tree contains from
1through10^5nodes. -10^9 <= Node.val <= 10^9.
More Akuna Capital Phone Screen questions
- Match Orders by Price and Arrival TimeOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Biased Coin: Probability of Exactly h HeadsPHONE SCREEN · Seen Nov 2026
- Positive Nth Root with Gradient DescentPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Two SumOA · PHONE SCREEN · Seen Sep 2026
- Tiered Expiring Item StorePHONE SCREEN · Seen Aug 2026
- Statistics for the Latest K ValuesPHONE SCREEN · Seen Nov 2025
- Remove Duplicates While Preserving OrderPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2025
- Sliding Window MaximumPHONE SCREEN · Seen Oct 2025
- Evaluate a PolynomialPHONE SCREEN · Seen Oct 2025
- Reverse Nodes in Groups of KPHONE SCREEN · Seen Oct 2025
Similar questions at other companies
- Balanced Binary TreeGoogle · PHONE SCREENGoogle interview questions
- Maximum Root-to-Leaf Sum in a BSTZillow · PHONE SCREENZillow interview questions
- Binary Tree Target-Sum PathsByteDance · PHONE SCREENByteDance interview questions
- Count Uni-Valued SubtreesAmazon · PHONE SCREEN
- Validate Binary Search TreeLyft · PHONE SCREENLyft interview questions
- Check Whether a Tree Is a Sum TreeAdobe · PHONE SCREENAdobe interview questions
- Height-Balanced Binary TreeExpedia · ONSITE INTERVIEWExpedia interview questions
- Sum Root-to-Leaf NumbersMeta · ONSITE INTERVIEWMeta interview questions
- Binary Tree Maximum Path SumGoldman Sachs · ONSITE INTERVIEWGoldman Sachs interview questions
- Balanced Tree Node ReportNetflix · ONSITE INTERVIEWNetflix interview questions
Akuna Capital interview experiences
- Akuna Capital Quant Trader and QR Interviews: 5 Experiences
- Akuna Capital JQR CodePair Rounds: 8 Experiences (Part 6 of 6)
- Akuna Capital QR Probability Phones: 14 Experiences (Part 5 of 6)
- Akuna Capital QR-ML Interviews: 11 Experiences (Part 4 of 6)
- Akuna Capital QR Regression Rounds: 11 Experiences (Part 3 of 6)
- Akuna Capital QR Coding Interviews: 17 Experiences (Part 2 of 6)