mirror of
https://github.com/prdlk/leetcode.git
synced 2026-08-02 17:31:40 +00:00
docs(index): update documentation content and structure
This commit is contained in:
+58
-21
@@ -1,31 +1,68 @@
|
|||||||
---
|
---
|
||||||
title: Hello World
|
title: Introduction
|
||||||
description: A Fumapress site styled with shadcn/typeset
|
description: Prad's Random CS Notes
|
||||||
---
|
---
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
This page renders through Fumadocs MDX and is styled by the `typeset typeset-docs` container — headings, paragraphs, lists, tables, and code all inherit their rhythm from three variables: `--typeset-size`, `--typeset-leading`, and `--typeset-flow`.
|
This is a collection of random CS notes that I've made over the years. I've been learning CS for a while now and I thought it would be a good idea to make a public repository of my notes. This is the first iteration of the repository and I plan to add more content to it over time.
|
||||||
|
|
||||||
### Why one CSS file?
|
## The Golden Rule (Memorize This)
|
||||||
|
|
||||||
- The file lives in your repo — edit rules directly, no plugin config
|
**Only sort if the problem asks for ORDER or RANKING.**
|
||||||
- Spacing flows one direction (`margin-block-start` only), so streamed content never restyles earlier blocks
|
|
||||||
- Zero-specificity `:where()` guards mean Tailwind utilities always win
|
|
||||||
|
|
||||||
```ts
|
If the problem asks for:
|
||||||
// Inline overrides still work inside a typeset container
|
- "first"
|
||||||
export const rhythm = {
|
- "index"
|
||||||
size: "15px",
|
- "position"
|
||||||
leading: 1.75,
|
- "does it exist"
|
||||||
flow: "1.5em",
|
- "true/false"
|
||||||
};
|
- "count how many"
|
||||||
```
|
|
||||||
|
→ **DO NOT SORT**. Just use the frequency map and loop.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Decision Cheat Sheet
|
||||||
|
|
||||||
|
| What the problem wants | Do you need to sort? | What to do instead | Example Problem |
|
||||||
|
|-----------------------------------------|----------------------|-------------------------------------|---------------------|
|
||||||
|
| Sort characters by how often they appear | YES | Freq + Sort | LC 451 |
|
||||||
|
| Top K most frequent | YES | Freq + Sort + slice | LC 347 |
|
||||||
|
| Sort array by frequency | YES | Freq + Sort | LC 1636 |
|
||||||
|
| First unique character (index) | NO | Freq + loop original string | LC 387 |
|
||||||
|
| Is it an anagram? | NO | Freq + check counts | LC 242 |
|
||||||
|
| How many numbers smaller than current | Kind of | Freq + prefix count | LC 1365 |
|
||||||
|
| Most frequent element | NO | Freq + find max | LC 169 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Mental Checklist (Say this out loud every time)
|
||||||
|
|
||||||
|
1. "Did I count the frequencies?" → Yes
|
||||||
|
2. "Does the problem care about the **original order**?"
|
||||||
|
- Yes → Loop the original string/array and check freq
|
||||||
|
- No → You can sort
|
||||||
|
3. "Does it want an **index** or a **boolean**?"
|
||||||
|
- Yes → Almost never sort
|
||||||
|
4. "Does it want the elements **re-ordered**?"
|
||||||
|
- Yes → Sort by frequency
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Super Short Version to Tattoo in Your Brain
|
||||||
|
|
||||||
|
**"If it wants the first / index / true-false → loop original.
|
||||||
|
If it wants sorted / top k / reordered → sort."**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Practice Trigger Words
|
||||||
|
|
||||||
|
- "first non-repeating" → Loop original
|
||||||
|
- "return its index" → Loop original
|
||||||
|
- "sort by frequency" → Sort
|
||||||
|
- "top k frequent" → Sort + slice
|
||||||
|
- "valid anagram" → Just check counts
|
||||||
|
|
||||||
> Tune a tighter preset for chat, a roomier one for docs — same file, different rhythm.
|
|
||||||
|
|
||||||
| Control | Purpose | Default |
|
|
||||||
| ------------------ | --------------------- | -------- |
|
|
||||||
| `--typeset-size` | Base text size | `1em` |
|
|
||||||
| `--typeset-leading`| Line height | `1.75` |
|
|
||||||
| `--typeset-flow` | Space between blocks | `1.25em` |
|
|
||||||
|
|||||||
Reference in New Issue
Block a user