# CODE

````python
import os

for f in os.listdir("../leetcode"):
    path = f"../leetcode/{f}"
    print(f"Checking path {path}")
    if not os.path.isdir(path):
        continue
    if path == "../scripts":
        continue
    for code_file in os.listdir(path):
        if not code_file.endswith(".py"):
            continue
        full_file_name = path + "/" + code_file
        print(f"Found python code: {full_file_name}")
        with open(full_file_name, "r") as fr:
            code = fr.read()
        with open(path + "/CODE.md", "w") as fw:
            fw.write(f"```python\n{code}\n```\n")
        print(f"Wrote: {path}/CODE.md")
    if os.path.exists(path + "/NOTES.md"):
        print(f"Removing: {path}/NOTES.md")
        os.remove(path + "/NOTES.md")
````


---

# 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://chiragjain.gitbook.io/neetcode/scripts/code.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.
