Tap here to switch tabs
Problem
Submissions

Problem: Stamping The Sequence

med
30 min
Try to solve the Stamping The Sequence problem.

Statement

You are given two strings, stamp and target. Initially, a string s of length target.length contains only question mark characters ('?').

In one turn, you may place stamp over s at an index ii such that 0≤i≤target.length−stamp.length0 \le i \le \text{target.length} - \text{stamp.length}, overwriting stamp.length consecutive characters of s with the characters from stamp.

Return an array containing the starting indices of the stamp applied in each turn to transform s into target. If target cannot be formed within 10×target.length10 \times \text{target.length} turns, return an empty array. If there are multiple answers, return any of them.

Constraints:

  • 1≤1 \le stamp.length ≤\le target.length ≤1000\le 1000

  • stamp and target consist of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Stamping The Sequence

med
30 min
Try to solve the Stamping The Sequence problem.

Statement

You are given two strings, stamp and target. Initially, a string s of length target.length contains only question mark characters ('?').

In one turn, you may place stamp over s at an index ii such that 0≤i≤target.length−stamp.length0 \le i \le \text{target.length} - \text{stamp.length}, overwriting stamp.length consecutive characters of s with the characters from stamp.

Return an array containing the starting indices of the stamp applied in each turn to transform s into target. If target cannot be formed within 10×target.length10 \times \text{target.length} turns, return an empty array. If there are multiple answers, return any of them.

Constraints:

  • 1≤1 \le stamp.length ≤\le target.length ≤1000\le 1000

  • stamp and target consist of lowercase English letters.