PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Meta

Implement array parity and tree level views

Last updated: Apr 19, 2026

Quick Overview

This question evaluates proficiency in array frequency analysis and binary tree traversal, testing skills in data structures, correctness reasoning, and algorithm implementation.

  • easy
  • Meta
  • Coding & Algorithms
  • Software Engineer

Implement array parity and tree level views

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

Implement the following coding tasks. 1. **Check whether all values occur an even number of times** - Input: an integer array `nums`. - Output: return `true` if every distinct value appears an even number of times, otherwise return `false`. - Example: `[1, 2, 1, 2, 3, 3] -> true`, `[4, 5, 4, 5, 4] -> false`. 2. **Compute several breadth-first traversal results for a binary tree** - Input: the root of a binary tree. - Implement functions to return: - the nodes visible when the tree is viewed from the right side, - the nodes visible when the tree is viewed from the left side, - the average value of nodes at each depth level. - Example: - For a tree with level order `[3, 9, 20, null, null, 15, 7]`, - right view -> `[3, 20, 7]` - left view -> `[3, 9, 15]` - level averages -> `[3.0, 14.5, 11.0]` A breadth-first traversal approach is acceptable for the tree problems.

Quick Answer: This question evaluates proficiency in array frequency analysis and binary tree traversal, testing skills in data structures, correctness reasoning, and algorithm implementation.

Related Interview Questions

  • Palindrome After Deleting at Most One Character - Meta (medium)
  • Validate Sorted Order Under a Custom Alphabet - Meta (medium)
  • Find Shortest Unique Prefixes - Meta (medium)
  • Compute Exclusive Execution Times - Meta (medium)
  • Solve Tree Columns And Maze Variants - Meta (medium)
|Home/Coding & Algorithms/Meta

Implement array parity and tree level views

Meta logo
Meta
Mar 24, 2026, 12:00 AM
easySoftware EngineerTechnical ScreenCoding & Algorithms
4
0
Practice Read
Loading...

Implement the following coding tasks.

  1. Check whether all values occur an even number of times
    • Input: an integer array nums .
    • Output: return true if every distinct value appears an even number of times, otherwise return false .
    • Example: [1, 2, 1, 2, 3, 3] -> true , [4, 5, 4, 5, 4] -> false .
  2. Compute several breadth-first traversal results for a binary tree
    • Input: the root of a binary tree.
    • Implement functions to return:
      • the nodes visible when the tree is viewed from the right side,
      • the nodes visible when the tree is viewed from the left side,
      • the average value of nodes at each depth level.
    • Example:
      • For a tree with level order [3, 9, 20, null, null, 15, 7] ,
        • right view -> [3, 20, 7]
        • left view -> [3, 9, 15]
        • level averages -> [3.0, 14.5, 11.0]

A breadth-first traversal approach is acceptable for the tree problems.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

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

Master your tech interviews with 8,000+ 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
  • AI Coding 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.