# Linear Sequence

In general, the problems under this category fall under a similar problem scope as [Perfect Squares](/problems-guide/dynamic-programming-roadmap/warmup/perfect-squares.md) where the optimal answer can usually acquired by solving for every prefix/suffix of the array and then using the previously computed past states to compute the current state.

This is a combination of the trick to "re-frame the problem" and the recurrence pattern of "past states".


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://interviews.woojiahao.com/problems-guide/dynamic-programming-roadmap/linear-sequence.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
