Given a word and a crossword grid represented by a single row/column line, determine where the word can be placed by matching characters and blanks.
You are given a crossword-like line of cells and a word to place. Some cells already contain letters, while others may be blank or blocked. Your task is to determine whether the word can be placed so that it fits the available cells and matches any pre-filled letters.
A placement is valid if:
This is a straightforward string/array matching task where you scan candidate positions and check whether the word can be aligned without contradiction.
Example 1
Input
segment = "?a?c?", word = "abc"
Output
YES
Explanation
The word can fit if the first, third, and fifth cells are blanks and the middle fixed letters match the word where they overlap.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.