# Sequence longest increasing

`sequence-longest-increasing` · version 1.0.0 · Sequences & diffs · free, no key needed

Return one longest increasing subsequence with its length, original indexes, and values.

**Use when you need to: find longest increasing subsequence · return LIS indexes and values · longest strictly increasing subsequence.**

## Decide before calling

Read the [versioned contract](/v1/tools/sequence-longest-increasing/versions/1.0.0) and the supported scope below. Reuse `sequence-longest-increasing@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `sequence-longest-increasing@1.0.0` for find longest increasing subsequence. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- find longest increasing subsequence
- return LIS indexes and values
- longest strictly increasing subsequence
- longest non decreasing subsequence
- get increasing sequence positions
- compute LIS with original indexes

## Not supported

- longest decreasing subsequence
- return every tied subsequence

## Behavior

- All outputs include standard_version.
- Input order is preserved when the result is set-like.
- Integers, decimal strings, and strings are compared without binary floating-point conversion.
- Patience tails replace with the current index, including equal strict tails; predecessor links reconstruct from the final tail.

## Input

- `values` (array of integer or string, required): min items 1; max items 256
- `strict` (boolean, optional): default `true`

## Output

- `standard_version` (constant "Fredman-1975", required)
- `length` (integer, required): min 1; max 256
- `indexes` (array of integer, required): min items 1; max items 256; each min 0; each max 255
- `values` (array of integer or string, required): min items 1; max items 256

## Limits

- max input bytes: 32768
- max items: 256
- max iterations: 4095
- max output bytes: 32768

## Example

Request input:

```json
{
  "values": [
    3,
    1,
    2,
    2,
    4
  ]
}
```

Response:

```json
{
  "result": {
    "standard_version": "Fredman-1975",
    "length": 3,
    "indexes": [
      1,
      3,
      4
    ],
    "values": [
      1,
      2,
      4
    ]
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "sequence-longest-increasing",
  "version": "1.0.0",
  "input": {
    "values": [
      3,
      1,
      2,
      2,
      4
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/sequence-longest-increasing/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"values":[3,1,2,2,4]}'
```

The machine-readable contract is at [/v1/tools/sequence-longest-increasing/versions/1.0.0](/v1/tools/sequence-longest-increasing/versions/1.0.0).

### CLI

```sh
node cli.mjs run sequence-longest-increasing 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Myers common subsequence](/tools/myers-common-subsequence): Return a canonical indexed LCS witness derived from bounded Myers search, or null when its cap is exceeded.
- [Myers diff bounded](/tools/myers-diff-bounded): Produce a canonical Myers edit script within a caller distance cap, or a deterministic over-cap result.
- [Sequence strict order check](/tools/sequence-strict-order-check): Check an exact strictly ascending or descending source-index ordering claim.
- [Myers distance bounded](/tools/myers-distance-bounded): Compute Myers insert/delete distance up to a caller cap, returning null predictably when the cap is exceeded.
- [Sequence LCS](/tools/sequence-lcs): Compute the longest common subsequence of two bounded sequences from the Myers shortest edit script.
- [Sequence longest common substring](/tools/sequence-lcsubstring): Find the longest contiguous common subarray of two bounded sequences.
