# Two Pointers

双指针算法是数组/字符串问题常见的一种解决方法。

* 相向双指针，指的是在算法的一开始，两根指针分别位于数组/字符串的两端，并相向行走
* 同向双指针的问题，是指两根指针都从头出发，朝着同一个方向前进


---

# 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://luj.gitbook.io/code/two-pointers.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.
