PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Meta

Solve four data structure and algorithms tasks

Last updated: Mar 29, 2026

Quick Overview

This set of tasks evaluates core algorithmic competencies such as tree traversal and level-order processing, data-structure design and counting maps, recursive subtree aggregation for statistical checks, and optimization/search techniques for partitioning problems, all within the Coding & Algorithms domain.

  • Medium
  • Meta
  • Coding & Algorithms
  • Software Engineer

Solve four data structure and algorithms tasks

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

1) Print the numbers at each level of a binary tree. Given the root, output the values level-by-level (each level on a new line or as a list of lists). State the time and space complexity. 2) Implement a class that stores input strings and their occurrence counts with methods: add(s), count(s) -> current count, and remove(s). Follow-ups: compute the total count across all stored data efficiently; generalize to support arbitrary data types (not just strings) and interchangeable underlying data structures; discuss concurrency and complexity trade-offs. 3) Given a binary tree with integer values, determine for each node whether its value equals the average of all values in its subtree (including itself). Return the number of nodes that satisfy the condition. Design an O(n) solution. 4) Given an array of wood lengths and an integer k, find the maximum integer length L such that cutting the wood into pieces of length L yields at least k pieces (no joining allowed). If impossible, return 0. Explain and implement your algorithm.

Quick Answer: This set of tasks evaluates core algorithmic competencies such as tree traversal and level-order processing, data-structure design and counting maps, recursive subtree aggregation for statistical checks, and optimization/search techniques for partitioning problems, all within the Coding & Algorithms domain.

Related Interview Questions

  • Solve Tree Columns And Maze Variants - Meta (medium)
  • Solve Tree Diameter and Palindromic Counts - Meta (medium)
  • Simulate Monster Team Battles - Meta (hard)
  • Solve a Key-Door Corridor Maze - Meta (medium)
  • Solve Array Merge and Parentheses Cleanup - Meta (medium)
Meta logo
Meta
Sep 6, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
2
0
  1. Print the numbers at each level of a binary tree. Given the root, output the values level-by-level (each level on a new line or as a list of lists). State the time and space complexity.
  2. Implement a class that stores input strings and their occurrence counts with methods: add(s), count(s) -> current count, and remove(s). Follow-ups: compute the total count across all stored data efficiently; generalize to support arbitrary data types (not just strings) and interchangeable underlying data structures; discuss concurrency and complexity trade-offs.
  3. Given a binary tree with integer values, determine for each node whether its value equals the average of all values in its subtree (including itself). Return the number of nodes that satisfy the condition. Design an O(n) solution.
  4. Given an array of wood lengths and an integer k, find the maximum integer length L such that cutting the wood into pieces of length L yields at least k pieces (no joining allowed). If impossible, return 0. Explain and implement your algorithm.

Submit Your Answer

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,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.