PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Meta

Implement encoding validation and grid shortest path

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in bit-level data validation and graph traversal algorithms by testing byte-encoding validation using bit-pattern recognition and an 8-neighbor shortest-path search on a binary grid, and it falls under the Coding & Algorithms domain.

  • Medium
  • Meta
  • Coding & Algorithms
  • Software Engineer

Implement encoding validation and grid shortest path

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Part A — Byte-encoding validation: You are given an array of integers in [0, 255] representing bytes. Determine whether the sequence encodes valid characters under a variable-length scheme where: ( 1) A single-byte character starts with leading bit 0; ( 2) A multi-byte character uses k bytes for k in {2,3,4}, whose first byte has a prefix of exactly k ones followed by a zero (e.g., 110xxxxx, 1110xxxx, 11110xxx); ( 3) Each continuation byte starts with the bit pattern 10xxxxxx; ( 4) The sequence cannot end mid-character. Return true/false and specify the time and space complexity of your approach. Part B — 8-neighbor grid shortest path: Given an n×n grid of 0s (open) and 1s (blocked), find the length of the shortest path from (0, 0) to (n−1,n− 1) moving in any of the 8 directions to adjacent open cells. Count both start and end cells in the length; if no path exists, return −1. Discuss the algorithm and its complexity.

Quick Answer: This question evaluates proficiency in bit-level data validation and graph traversal algorithms by testing byte-encoding validation using bit-pattern recognition and an 8-neighbor shortest-path search on a binary grid, and it falls under the Coding & Algorithms domain.

Related Interview Questions

  • Solve Tree Columns And Maze Variants - Meta (medium)
  • Solve a Key-Door Corridor Maze - Meta (medium)
  • Solve Array Merge and Parentheses Cleanup - Meta (medium)
  • Solve Two Backtracking Array Problems - Meta (hard)
  • Solve Maze and Suffix Problems - Meta (medium)
Meta logo
Meta
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
1
0

Part A — Byte-encoding validation: You are given an array of integers in [0, 255] representing bytes. Determine whether the sequence encodes valid characters under a variable-length scheme where: (

  1. A single-byte character starts with leading bit 0; (
  2. A multi-byte character uses k bytes for k in {2,3,4}, whose first byte has a prefix of exactly k ones followed by a zero (e.g., 110xxxxx, 1110xxxx, 11110xxx); (
  3. Each continuation byte starts with the bit pattern 10xxxxxx; (
  4. The sequence cannot end mid-character. Return true/false and specify the time and space complexity of your approach. Part B — 8-neighbor grid shortest path: Given an n×n grid of 0s (open) and 1s (blocked), find the length of the shortest path from (0,
  5. to (n−1,n−
  6. moving in any of the 8 directions to adjacent open cells. Count both start and end cells in the length; if no path exists, return −1. Discuss the algorithm and its complexity.

Comments (0)

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