FastPrepCheck a Full Binary Tree
Problems/Check a Full Binary Tree

Check a Full Binary Tree

JP Morgan Chase logoJP Morgan Chase● EasyINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a JP Morgan Chase intern onsite interview. The author reports coding a full-binary-tree check and explaining a recursive solution. We chose the node encoding, the limits, the examples and the answer for an empty tree. Our version is about 95% the same as the reported question.

Return whether every node in the binary tree root has either zero children or two children. Such a tree is called full. Node values and the depths of different leaves do not affect the answer.

For this exercise, assume an empty tree is full. Examples use the native level-order TreeNode representation: null means a missing child, and [] means an empty tree. Trailing null markers are omitted.

Function

isFullBinaryTree(root: TreeNode) → boolean

Examples

Example 1

root = [1,2,3]return = true
root
123

The root has two children, and each child has zero children.

Example 2

root = [1,2]return = false
root
12

The root has one left child and no right child, so it is not full.

Constraints

  • 0 <= number of level-order entries <= 1000, including null markers.
  • -1000000 <= node value <= 1000000.
  • The input is a valid level-order representation with trailing null markers omitted.

More JP Morgan Chase Onsite Interview questions

  • LFU CacheONSITE INTERVIEW · Seen Nov 2026
  • LRU CacheONSITE INTERVIEW · Seen Nov 2026
  • Employees Above Average SalaryONSITE INTERVIEW · Seen Sep 2026
  • Highest-Earning Employees By DepartmentONSITE INTERVIEW · Seen Sep 2026
  • K Largest Integers in Descending OrderONSITE INTERVIEW · Seen Aug 2026
  • Tile a Three-Row Board with DominoesONSITE INTERVIEW · Seen Jan 2026
  • Two SumONSITE INTERVIEW · Seen Nov 2025
  • Intersection of Two ListsONSITE INTERVIEW · Seen Jan 2025
  • Maximum Subarray SumONSITE INTERVIEW · Seen Jan 2025
  • Fibonacci NumberONSITE INTERVIEW · Seen Nov 2024

Similar questions at other companies

  • Decode a Bit String With a Code TreeGoogle · ONSITE INTERVIEWGoogle interview questions
  • Maximum Depth of Binary TreeLinkedIn · PHONE SCREEN · ONSITE INTERVIEWLinkedIn interview questions
  • Path SumSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Binary Tree Level-Order Traversal by LevelsAdobe · PHONE SCREEN · ONSITE INTERVIEWAdobe interview questions
  • Binary Tree Preorder TraversalAnduril · ONSITE INTERVIEWAnduril interview questions
  • Find the Root of a Directed TreeAmazon · ONSITE INTERVIEW
  • Symmetric Binary TreeFigma · ONSITE INTERVIEWFigma interview questions
  • Organization Chart by LevelMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Tree Level with the Most NodesBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Diameter of a Binary TreeMeta · ONSITE INTERVIEWMeta interview questions

Interview reports that mention this question

  • JPMorgan Tech Intern HackerRank OA: 11 Experiences (Part 3 of 5)

JP Morgan Chase interview experiences

  • JPMorgan Quant Stats Superdays: 3 Experiences (Part 3 of 3)
  • JPMorgan Quant Modeling Superdays: 7 Experiences (Part 2 of 3)
  • JPMorgan Quant Intern Superday: 19 Experiences (Part 1 of 3)
  • JP Morgan Chase Data and AI Intern Superday: 11 Experiences
  • JPMorgan Code for Good India 2024: 6 Experiences (Part 5 of 5)
All JP Morgan Chase interview questionsSee JP Morgan Chase hiring insights
Saved
/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     TreeNode left;
 *     TreeNode right;
 *     TreeNode() {}
 *     TreeNode(int val) { this.val = val; }
 *     TreeNode(int val, TreeNode left, TreeNode right) {
 *         this.val = val;
 *         this.left = left;
 *         this.right = right;
 *     }
 * }
 */
class Solution {
    public boolean isFullBinaryTree(TreeNode root) {
        // Write your code here.
    }
}
Checking account…