PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Meta

Solve linked list, tree, and grid problems

Last updated: Mar 29, 2026

Quick Overview

This set evaluates mastery of core data structures and algorithmic reasoning across singly linked lists (cycle entry detection), binary search trees with parent pointers (in-order successor), constant-time state tracking for n×n game boards, and grid connectivity for maximizing component size, emphasizing pointer manipulation, traversal logic, state-design, and component analysis. Commonly asked to gauge proficiency in Coding & Algorithms and complexity analysis, these problems test both conceptual understanding of traversal and connectivity principles and practical application of space- and time-efficient implementations under typical interview constraints.

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

Solve linked list, tree, and grid problems

Company: Meta

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

### Problem A — Find cycle entry in a singly linked list You are given the head of a singly linked list. The list may contain a cycle. - Return the node where the cycle begins. - If there is no cycle, return `null`. - **Constraints:** O(1) extra space. Aim for linear time. --- ### Problem B — In-order successor with parent pointers You are given a node `x` in a binary search tree (BST). Each node has pointers `left`, `right`, and `parent`. - Return the in-order successor of `x` (the next node visited in an in-order traversal). - If `x` has no in-order successor, return `null`. --- ### Problem C — Design an n×n tic-tac-toe checker Implement a class for an `n × n` board supporting: - `move(row, col, player)` which places `player` (1 or 2) at `(row, col)` (assume valid and empty). - After each move, return: - `0` if no one has won, - `1` if player 1 wins, - `2` if player 2 wins. **Goal:** Each move should be close to O(1) time. --- ### Problem D — Maximize island size by flipping one cell Given an `n × n` binary grid (`0` water, `1` land), an island is a 4-directionally connected component of `1`s. - You may flip **at most one** `0` to `1`. - Return the maximum possible island size after the flip. **Constraints:** `1 ≤ n ≤ 500` (assume large enough that near-quadratic extra work may time out).

Quick Answer: This set evaluates mastery of core data structures and algorithmic reasoning across singly linked lists (cycle entry detection), binary search trees with parent pointers (in-order successor), constant-time state tracking for n×n game boards, and grid connectivity for maximizing component size, emphasizing pointer manipulation, traversal logic, state-design, and component analysis. Commonly asked to gauge proficiency in Coding & Algorithms and complexity analysis, these problems test both conceptual understanding of traversal and connectivity principles and practical application of space- and time-efficient implementations under typical interview constraints.

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
Dec 15, 2025, 12:00 AM
Machine Learning Engineer
Onsite
Coding & Algorithms
9
0

Problem A — Find cycle entry in a singly linked list

You are given the head of a singly linked list. The list may contain a cycle.

  • Return the node where the cycle begins.
  • If there is no cycle, return null .
  • Constraints: O(1) extra space. Aim for linear time.

Problem B — In-order successor with parent pointers

You are given a node x in a binary search tree (BST). Each node has pointers left, right, and parent.

  • Return the in-order successor of x (the next node visited in an in-order traversal).
  • If x has no in-order successor, return null .

Problem C — Design an n×n tic-tac-toe checker

Implement a class for an n × n board supporting:

  • move(row, col, player) which places player (1 or 2) at (row, col) (assume valid and empty).
  • After each move, return:
    • 0 if no one has won,
    • 1 if player 1 wins,
    • 2 if player 2 wins.

Goal: Each move should be close to O(1) time.

Problem D — Maximize island size by flipping one cell

Given an n × n binary grid (0 water, 1 land), an island is a 4-directionally connected component of 1s.

  • You may flip at most one 0 to 1 .
  • Return the maximum possible island size after the flip.

Constraints: 1 ≤ n ≤ 500 (assume large enough that near-quadratic extra work may time out).

Submit Your Answer to Earn 20XP

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