PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Meta

Solve tree, array, and maze tasks

Last updated: Apr 6, 2026

Quick Overview

This set of problems evaluates proficiency in algorithms and data structures, covering binary tree diameter computation, array optimization for maximum area between two indices, and weighted grid pathfinding with cell movement costs.

  • medium
  • Meta
  • Coding & Algorithms
  • Software Engineer

Solve tree, array, and maze tasks

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

You are given a set of algorithmic problems from a software engineering onsite. 1. **Tree path length**: Given the root of a binary tree, return the number of edges in the longest path between any two nodes in the tree. 2. **Choose two boundaries**: Given an array of non-negative integers where each value is the height of a vertical line at that index, choose two indices `i < j` that maximize `(j - i) * min(height[i], height[j])`. Return the maximum value. 3. **Weighted maze**: Given a 2D grid containing a start cell `S`, a target cell `T`, blocked cells `#`, and non-negative movement costs for traversable cells, compute the minimum total energy required to reach `T` from `S`. Moving into a cell adds that cell's cost. Return `-1` if the target is unreachable. In the later part of this coding interview, the candidate was allowed to use an AI coding assistant after first explaining the intended approach.

Quick Answer: This set of problems evaluates proficiency in algorithms and data structures, covering binary tree diameter computation, array optimization for maximum area between two indices, and weighted grid pathfinding with cell movement costs.

Related Interview Questions

  • Find Shortest Unique Prefixes - Meta (medium)
  • Compute Exclusive Execution Times - Meta (medium)
  • Solve Tree Columns And Maze Variants - Meta (medium)
  • Solve Tree Diameter and Palindromic Counts - Meta (medium)
  • Simulate Monster Team Battles - Meta (hard)
Meta logo
Meta
Oct 17, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
0
0
Loading...

You are given a set of algorithmic problems from a software engineering onsite.

  1. Tree path length : Given the root of a binary tree, return the number of edges in the longest path between any two nodes in the tree.
  2. Choose two boundaries : Given an array of non-negative integers where each value is the height of a vertical line at that index, choose two indices i < j that maximize (j - i) * min(height[i], height[j]) . Return the maximum value.
  3. Weighted maze : Given a 2D grid containing a start cell S , a target cell T , blocked cells # , and non-negative movement costs for traversable cells, compute the minimum total energy required to reach T from S . Moving into a cell adds that cell's cost. Return -1 if the target is unreachable.

In the later part of this coding interview, the candidate was allowed to use an AI coding assistant after first explaining the intended approach.

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
  • Compare Platforms
  • Discord Community

Support

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

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.