Search Mysterious Grid

Problem Overview

  • Count how many target symbols from a set appear in a character grid under strict path rules.
  • Input: a 2D char grid and a list of unique symbols; Output: total valid occurrences.
  • A match uses adjacent cells, starting anywhere, moving initially left-to-right or top-to-bottom, with at most one reversal.
  • Real-world theme: searching ancient symbols in a mysterious grid.
  • From Meta interviews; a coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: