mirror of
https://github.com/prdlk/leetcode.git
synced 2026-11-03 05:27:36 +00:00
docs(docs): restructure documentation paths and add new introduction file
This commit is contained in:
1 parent
995fed2950
commit
9e8117fcf6
19 files changed
+10
-44
No files matched your search
@@ -0,0 +1,66 @@
|
||||
---
|
||||
title: 'Arrays and Strings'
|
||||
description: 'In algorithms, arrays and strings are very similar. They are both ordered collections of elements. The difference is that arrays are mutable, while strings are immutable.'
|
||||
sidebar:
|
||||
icon: play
|
||||
label: Introduction
|
||||
---
|
||||
|
||||
|
||||
Technically, an array can't be resized. A dynamic array, or list, can be. In the context of algorithm problems, usually when people talk about arrays, they are referring to dynamic arrays. In this entire course, we will be talking about dynamic arrays/lists, but we will just use the word "array".
|
||||
|
||||
## Time Complexity
|
||||
|
||||
Arrays and strings are both ordered collections of elements. The difference is that arrays are mutable, while strings are immutable.
|
||||
|
||||
| Operation | Array/List | String(Immutable) |
|
||||
| --------- | ---------- | ----------------- |
|
||||
| Appending to end | *O(1) | O(n) |
|
||||
| Popping from end | O(1) | O(n) |
|
||||
| Insertion, not from end | O(n) | O(n) |
|
||||
| Deletion, not from end | O(n) | O(n) |
|
||||
| Modifying an element | O(1) | O(n) |
|
||||
| Random access | *O(1) | O(n) |
|
||||
| Checking if an element exists | O(1) | O(n) |
|
||||
|
||||
:::note[Clarification 1]
|
||||
Appending to the end of a list is amortized O(1) time complexity. This means that the time complexity of appending to the end of a list is the same as the time complexity of appending to the end of an array.
|
||||
:::
|
||||
|
||||
:::note[Clarification 2]
|
||||
Random access in this context means that you can access an element at any index in constant time.
|
||||
:::
|
||||
|
||||
## Patterns
|
||||
|
||||
<Columns cols={2}>
|
||||
<Column>
|
||||
<Tile
|
||||
title="Two Pointers"
|
||||
description="Ship your first page in minutes."
|
||||
href="/arrays-and-strings/two-pointers"
|
||||
>
|
||||
<Icon icon="rocket" size={28} />
|
||||
</Tile>
|
||||
</Column>
|
||||
<Column>
|
||||
<Tile
|
||||
title="Sliding Window"
|
||||
description="Ship your first page in minutes."
|
||||
href="/docs/quickstart"
|
||||
>
|
||||
<Icon icon="rocket" size={28} />
|
||||
</Tile>
|
||||
</Column>
|
||||
<Column>
|
||||
<Tile
|
||||
title="Prefix Sum"
|
||||
description="Ship your first page in minutes."
|
||||
href="/docs/quickstart"
|
||||
>
|
||||
<Icon icon="rocket" size={28} />
|
||||
</Tile>
|
||||
</Column>
|
||||
</Columns>
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
---
|
||||
title: 'Two Pointers'
|
||||
description: 'Converging/parallel index walk that prunes the O(n^2) pair space using order.'
|
||||
sidebar:
|
||||
icon: sticky-note
|
||||
---
|
||||
|
||||
:::warning[Under construction]
|
||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
||||
:::
|
||||
|
||||
## Concepts
|
||||
|
||||
|
||||
|
||||
|
||||
## Problems
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="344. Reverse String" href="/problems/reverse-string">
|
||||
</Card>
|
||||
<Card title="977. Squares of a Sorted Array" href="/problems/squares-of-a-sorted-array">
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: 'Sliding Window'
|
||||
description: 'Two pointers plus incremental state between them.'
|
||||
sidebar:
|
||||
icon: sticky-note
|
||||
---
|
||||
|
||||
:::warning[Under construction]
|
||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
||||
:::
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: 'Prefix Sum'
|
||||
description: 'Precomputed cumulative state for O(1) range queries.'
|
||||
sidebar:
|
||||
icon: sticky-note
|
||||
---
|
||||
|
||||
:::warning[Under construction]
|
||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
||||
:::
|
||||
@@ -0,0 +1,6 @@
|
||||
import { defineMeta } from "blume";
|
||||
|
||||
export default defineMeta({
|
||||
title: "Arrays & Strings",
|
||||
order: 4,
|
||||
});
|
||||
Reference in new issue
Block a user