Search
⌘K

Leetcode 2018. Check if Word Can Be Placed In Crossword

Given an m×n crossword grid of letters, blanks, and blocks, determine whether a target word can fit into any horizontal or vertical slot (in any direction) where the contiguous non-block cells either match the word's letters or are blank, and the slot is properly bounded by blocks or edges so it doesn't have extra letters/spaces adjacent to the placed word. Return true if any such placement exists.

Asked at:

Amazon

Amazon


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Late September, 2024

Amazon

Amazon

Mid-level

Implement a function to count and locate word placements in a crossword puzzle. Given a 2D matrix representing an empty crossword puzzle with 'B' for unavailable squares and 'W' for available squares, determine the number of places words can be placed horizontally or vertically of any length (including 1). Return the total count and coordinates for each possible word placement.

Comments

Your account is free and you can post anonymously if you choose.