Sequence longest common substring
sequence-lcsubstring · version 1.0.0 · Sequences & diffs · free, no key needed
Find the longest contiguous common subarray of two bounded sequences.
Use when you need to: sequence lcsubstring · longest common substring of two sequences · longest contiguous common subarray.
Supported
- sequence lcsubstring
- longest common substring of two sequences
- longest contiguous common subarray
Not supported
- longest common subsequence
- fuzzy matching
- unicode normalization
- locale compare
- patience unique anchors
Behavior
- left and right are sequences of JSON null, boolean, string, or IEEE-754 safe integer items.
- The result is the longest contiguous common subarray, not a subsequence.
- On equal length, the smallest left_start wins, then the smallest right_start.
- If length is 0, items is [], left_start is 0, and right_start is 0.
- left ["A","B","C","D"] and right ["X","B","C","Y"] yields items ["B","C"], left_start 1, right_start 1.
- The string "__proto__" is an ordinary item. Unknown input fields are rejected.
Input
left(array of null or boolean or string or integer, required): max items 1024right(array of null or boolean or string or integer, required): max items 1024
Output
items(array of null or boolean or string or integer, required): max items 1024length(integer, required): min 0left_start(integer, required): min 0right_start(integer, required): min 0
Limits
- max sequence items: 1024
- max item string bytes: 4096
- max text bytes: 262144
- max output bytes: 1048576
Example
Request input:
{
"left": [
"A",
"B",
"C",
"D"
],
"right": [
"X",
"B",
"C",
"Y"
]
}
Response:
{
"result": {
"items": [
"B",
"C"
],
"length": 2,
"left_start": 1,
"right_start": 1
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "sequence-lcsubstring",
"version": "1.0.0",
"input": {
"left": [
"A",
"B",
"C",
"D"
],
"right": [
"X",
"B",
"C",
"Y"
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/sequence-lcsubstring/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"left":["A","B","C","D"],"right":["X","B","C","Y"]}'
The machine-readable contract is at /v1/tools/sequence-lcsubstring/versions/1.0.0.
CLI
node cli.mjs run sequence-lcsubstring 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Sequence LCS: Compute the longest common subsequence of two bounded sequences from the Myers shortest edit script.
- Sequence edit script: Compute the Myers shortest edit script between two bounded sequences, with keep/delete/insert counts.
- Sequence three way merge: Three-way merge two sequence descendants against a shared base into clean or conflict regions.
- Sequence compose edit scripts: Compose two sequence edit scripts into one per-item keep/delete/insert script.
- Sequence apply edit script: Apply a keep/delete/insert edit script to a bounded sequence with exact value matching and no fuzz.
- Sequence apply hunks: Apply disjoint original-address sequence hunks with exact context and no fuzz.