# LeetCode

The following bit of code is essentially just an extension for myself that organizes GitBook's summary.md file to be coherent to order of leetcode problem sets.

```python
import collections
import re


def gitbook_clean_summary(in_file):
    """
    :type in_file: string
    :rtype: void
    """

    file_out = open("SUMMARY_SORTED.md", "w")

    with open(in_file, 'r') as file:
        lines = file.readlines()
        numbers = [int(re.search(r'\d+', line).group()) for line in lines]
        elements = dict([(line, number) for number, line in zip(lines, numbers)])
        sort_d = collections.OrderedDict(sorted(elements.items()))

    for key in sort_d:
        file_out.write('%s' % sort_d[key])

    file_out.close()


# note: SUMMARY.md must only contain 'LeetCode' parent folder
# detecting no number in lines will cause an exception to be thrown
gitbook_clean_summary("SUMMARY.md")
```

## Incomplete solutions

* 15
* 313
* 23
* 312
* 301
* 322
* 351
* 43
* 44
* 53
* 6 - time limited exceeded
* 54
* 42
* 140
* 512


---

# 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://maksimdan.gitbook.io/interview-practice-problems/leetcode_sessions.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.
