PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Snapchat

Check if a binary tree is complete

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of binary tree properties and traversal techniques, testing competency in data structures and algorithmic reasoning related to tree completeness.

  • medium
  • Snapchat
  • Coding & Algorithms
  • Software Engineer

Check if a binary tree is complete

Company: Snapchat

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given the root of a binary tree. Determine whether the tree is a **complete binary tree**. A binary tree is complete if: - Every level, except possibly the last, is completely filled. - All nodes in the last level are as far left as possible. ### Input - `root`: root node of a binary tree (or `null`). ### Output - Return `true` if the tree is complete; otherwise return `false`. ### Constraints - Number of nodes: `0..10^5` - Node values are irrelevant to completeness. ### Notes - Aim for an algorithm that is correct for large trees; discuss time complexity and space usage (e.g., typical BFS approach vs. any space optimizations).

Quick Answer: This question evaluates understanding of binary tree properties and traversal techniques, testing competency in data structures and algorithmic reasoning related to tree completeness.

Related Interview Questions

  • Determine Whether Courses Can Be Completed - Snapchat (medium)
  • Solve Decimal Coin Change - Snapchat (medium)
  • Find Maximum Island Perimeter - Snapchat (medium)
  • Solve Three Algorithmic Tasks - Snapchat (hard)
  • Implement a Timestamped Counter - Snapchat (medium)
Snapchat logo
Snapchat
Feb 8, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
5
0
Loading...

You are given the root of a binary tree. Determine whether the tree is a complete binary tree.

A binary tree is complete if:

  • Every level, except possibly the last, is completely filled.
  • All nodes in the last level are as far left as possible.

Input

  • root : root node of a binary tree (or null ).

Output

  • Return true if the tree is complete; otherwise return false .

Constraints

  • Number of nodes: 0..10^5
  • Node values are irrelevant to completeness.

Notes

  • Aim for an algorithm that is correct for large trees; discuss time complexity and space usage (e.g., typical BFS approach vs. any space optimizations).

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Snapchat•More Software Engineer•Snapchat Software Engineer•Snapchat Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.