PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Meta

Implement bounds, minimum, pathfinding, and moving average

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency with core data structures and algorithms—specifically array operations (merge and bounds), minimum-finding strategies, 2D graph pathfinding (BFS vs. DFS and path reconstruction), and streaming sliding-window statistics (moving average).

  • Medium
  • Meta
  • Coding & Algorithms
  • Machine Learning Engineer

Implement bounds, minimum, pathfinding, and moving average

Company: Meta

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

Solve the following data-structures problems: ( 1) Given two sorted integer lists A and B, merge them into a single non-decreasing array. Then, for a target x, return the indices of the first element ≥ x (lower bound) and the first element > x (upper bound) in the merged array. Specify time and space complexity, and handle duplicates and empty inputs. ( 2) Implement a function that returns the minimum value in an array; discuss approaches and edge cases for both sorted and unsorted arrays. ( 3) Given a 2D grid of 0s (open) and 1s (walls) and a start cell, find a path to any exit on the grid boundary (an open boundary cell) and return the path as a list of coordinates. Discuss BFS vs. DFS, how to reconstruct the path, and complexity. ( 4) Design a class MovingAverage(k) that ingests a stream of numbers and returns the average of the last k values after each insertion. Support amortized O( 1) updates/queries and define behavior when the stream has fewer than k elements.

Quick Answer: This question evaluates proficiency with core data structures and algorithms—specifically array operations (merge and bounds), minimum-finding strategies, 2D graph pathfinding (BFS vs. DFS and path reconstruction), and streaming sliding-window statistics (moving average).

Related Interview Questions

  • Solve Two Backtracking Array Problems - Meta (hard)
  • Solve Array, Matrix, and Recommendation Problems - Meta (medium)
  • Find a String Containing Another - Meta (medium)
  • Solve Subarray Sum and Local Minimum - Meta (hard)
  • Validate abbreviations and brackets - Meta (medium)
Meta logo
Meta
Sep 6, 2025, 12:00 AM
Machine Learning Engineer
Onsite
Coding & Algorithms
3
0

Solve the following data-structures problems: (

  1. Given two sorted integer lists A and B, merge them into a single non-decreasing array. Then, for a target x, return the indices of the first element ≥ x (lower bound) and the first element > x (upper bound) in the merged array. Specify time and space complexity, and handle duplicates and empty inputs. (
  2. Implement a function that returns the minimum value in an array; discuss approaches and edge cases for both sorted and unsorted arrays. (
  3. Given a 2D grid of 0s (open) and 1s (walls) and a start cell, find a path to any exit on the grid boundary (an open boundary cell) and return the path as a list of coordinates. Discuss BFS vs. DFS, how to reconstruct the path, and complexity. (
  4. Design a class MovingAverage(k) that ingests a stream of numbers and returns the average of the last k values after each insertion. Support amortized O(
  5. updates/queries and define behavior when the stream has fewer than k elements.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Meta•More Machine Learning Engineer•Meta Machine Learning Engineer•Meta Coding & Algorithms•Machine Learning 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.