z_algorithm
Compute a string's Z-array or find pattern matches in linear time, using an optional pattern to search the input text.
Instructions
Compute the Z-array for a string, or find pattern matches using the Z-algorithm in linear time.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Input text | |
| pattern | No | Optional pattern to search for |