GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - SinceraXY/Algorithm_code: Record the solution code, thinking process, and insights for daily algorithm problems, continuously accumulate and systematically review them, to help build a ‘searchable, reusable, and evolvable’ problem-solving knowledge base.

BranchesTags
Open more actions menu

Latest commit

 

History

49 Commits
49 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
leetcode
leetcode
 
 
notes
notes
 
 
剑指offer
剑指offer
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

Algorithm_code

记录日常算法题的解题代码、思路与心得,持续积累、系统化复盘,帮助自己构建“可检索、可复用、可演进”的题解知识库。

License: MIT Last Commit Issues Stars


目录

  • Algorithm_code
    • 目录
    • 目标与宗旨
    • 内容组织与目录约定
    • 文件命名规范
    • 题解模板(建议)
    • 如何运行
    • 代码风格与工具建议
    • 提交信息与分支规范
    • 规划与进度追踪
    • 贡献指南
    • License
    • 致谢

目标与宗旨

  • 系统化:以专题与难度为主线组织题目,沉淀通用解题套路与模板。
  • 实战化:每道题给出可运行代码与复杂度分析,尽量附上边界用例和对拍思路。
  • 复盘化:记录“为什么卡住”“如何优化”的思考过程,避免二次踩坑。

内容组织与目录约定

建议采用“平台 → 难度 → 题目文件夹”的层级组织;同一题的不同语言解法统一放在该题文件夹内。

.
├─ leetcode/
│  ├─ easy/
│  │  ├─ 0001_two_sum/
│  │  │  ├─ README.md           # 本题题解与思路
│  │  │  ├─ solution.py         # 示例:Python 解法
│  │  │  ├─ solution.cpp        # 示例:C++ 解法
│  │  │  └─ solution_v2.py      # 多解可追加 v2/v3 或方法名
│  │  ├─ 0239_sliding_window_maximum/
│  │  │  └─ ...
│  ├─ medium/
│  └─ hard/
├─ nowcoder/
├─ acwing/
├─ templates/          # 常用模板:并查集、单调栈/队列、前缀和、差分、二分、DP 框架等
├─ notes/              # 专题笔记、思路总结、易错点、复杂度分析
│  ├─ topics/
│  └─ mistakes/
├─ scripts/            # 辅助脚本(对拍、统计、生成目录)
└─ README.md

文件命名规范

  • 题目文件夹:题号_题目英文蛇形
    • 例如:0001_two_sum、0239_sliding_window_maximum
  • 题解文件(文件夹内):
    • 主解:solution.py、solution.cpp、solution.java、solution.js 等
    • 多解:solution_v2.py、two_pointers.cpp、binary_search.py 等
  • 题解说明(可选):每题文件夹内放 README.md,记录思路与复杂度。
  • 备用方案(不建题目文件夹时):可退而使用单文件命名 lc_0001_two_sum.py,但不推荐。

题解模板(建议)

为便于复盘,建议每题附带简短说明。可复制下面模板到每题的 README.md 或题解顶部注释中。

# 题目:<标题>
- 平台:<LeetCode / NowCoder / ...>
- 链接:<题目链接>
- 难度:<Easy / Medium / Hard>

## 思路
- 核心:
- 关键细节:
- 边界情况:

## 复杂度
- 时间:O(...)
- 空间:O(...)

## 代码(Python 示例)
```python
from typing import List

class Solution:
    def twoSum(self, nums: List[int], target: int) -> List[int]:
        index_by_value = {}
        for i, x in enumerate(nums):
            if (target - x) in index_by_value:
                return [index_by_value[target - x], i]
            index_by_value[x] = i
        return []
```

## 备注
- 可选:对拍脚本、对比多种写法的优缺点

如何运行

不同语言按需选择:

  • Python

    • 直接运行:python leetcode/easy/0001_two_sum/solution.py
    • 建议创建虚拟环境并使用 requirements.txt(若有):
      python -m venv .venv
      .venv/Scripts/activate  # Windows
      pip install -r requirements.txt
  • C++

    • 编译运行:
      g++ -std=c++17 -O2 -Wall leetcode/easy/0239_sliding_window_maximum/solution.cpp -o main && ./main
  • Java

    • 编译运行:
      javac leetcode/easy/0001_two_sum/Solution.java && java -cp leetcode/easy/0001_two_sum Solution
  • JavaScript/TypeScript

    • 运行:node leetcode/easy/0001_two_sum/solution.js 或使用 ts-node(TypeScript)

可在 scripts/ 中添加对拍与统计脚本(例如:随机数据生成、不同解法耗时对比、目录自动索引)。


代码风格与工具建议

  • Python:ruff + black
  • C++:clang-format + cpplint
  • JavaScript/TypeScript:eslint + prettier
  • Git Hooks:可使用 pre-commit 统一做格式化与静态检查

提交信息与分支规范

推荐采用 Conventional Commits:

  • feat: add leetcode/easy/0001_two_sum: python solution
  • refactor: leetcode/easy/0239_sliding_window_maximum: optimize using deque
  • docs: add notes/topics/动态规划-背包九讲

分支建议:

  • main:稳定可读的题解与文档
  • feat/<topic-or-problem>:新题/新专题开发

规划与进度追踪

  • 每周目标:至少 4 道(覆盖 1-2 个专题)
  • 专题清单(示例):
    • 基础:哈希、双指针、二分、栈/队列、链表、树/图遍历
    • 进阶:滑动窗口、前缀和/差分、并查集、字典树、拓扑排序
    • 动态规划:背包、区间 DP、状态压缩、数位 DP
    • 经典题单复盘与错题集
  • 数据统计(可选):维护 scripts/stats.py 输出完成度报表

贡献指南

欢迎提交 Issue/PR:

  1. Fork 本仓库,创建特性分支:git checkout -b feat/xxx
  2. 按上述目录与命名提交题解与说明
  3. 确保代码可运行、说明完整、通过基本测试
  4. 提交 PR 并简述变更

License

本仓库采用 MIT 协议开源。仓库根目录包含 LICENSE 文件(MIT)。


致谢

  • 平台题源与社区讨论:LeetCode、牛客、AcWing 等
  • 开源工具与格式化规范维护者

如果你也在刷题,欢迎交流思路与补充更优解法 🙌

About

Record the solution code, thinking process, and insights for daily algorithm problems, continuously accumulate and systematically review them, to help build a ‘searchable, reusable, and evolvable’ problem-solving knowledge base.

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing
Activity

Stars

3 stars

Watchers

1 watching

Forks

0 forks
Report repository

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.