{"id":28164258,"url":"https://github.com/honkinglin/algorithm","last_synced_at":"2026-01-24T10:38:54.619Z","repository":{"id":143993079,"uuid":"423170227","full_name":"honkinglin/algorithm","owner":"honkinglin","description":"Record my algorithm learning path","archived":false,"fork":false,"pushed_at":"2025-11-05T07:22:55.000Z","size":4106,"stargazers_count":3,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-13T17:30:48.759Z","etag":null,"topics":["algorithm","leetcode"],"latest_commit_sha":null,"homepage":"https://algorithm-chi.vercel.app/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/honkinglin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-10-31T14:26:46.000Z","updated_at":"2025-11-05T07:22:59.000Z","dependencies_parsed_at":"2025-02-26T01:31:08.199Z","dependency_job_id":"6764e505-353c-430a-a3a5-4a99d8ccc3f7","html_url":"https://github.com/honkinglin/algorithm","commit_stats":null,"previous_names":["honkinglin/algorithm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/honkinglin/algorithm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honkinglin%2Falgorithm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honkinglin%2Falgorithm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honkinglin%2Falgorithm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honkinglin%2Falgorithm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/honkinglin","download_url":"https://codeload.github.com/honkinglin/algorithm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honkinglin%2Falgorithm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28725376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T10:24:43.181Z","status":"ssl_error","status_checked_at":"2026-01-24T10:24:36.112Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","leetcode"],"created_at":"2025-05-15T11:16:24.960Z","updated_at":"2026-01-24T10:38:54.613Z","avatar_url":"https://github.com/honkinglin.png","language":null,"readme":"# 🧠 算法学习笔记\n\n这个仓库记录了我系统化学习算法的全过程，重点在于理解题目模式、构建可复用的解题模板。我按照不同算法主题对题目进行分类，结合生活类比，帮助抽象概念更直观地理解，并配套清晰的注释和多种解法对比。\n\n## 🗂️ 学习方法\n\n* **按专题分类刷题**：不按题号顺序刷题，而是按技巧类型归类整理\n* **使用生活类比辅助理解**：比如链表用“火车车厢”、前缀和用“查账”、回溯用“试穿衣服”等\n* **模板驱动学习**：先掌握通用模板（如滑动窗口、二分、回溯），再灵活变形\n* **多解法对比分析**：包括暴力解法、优化解法及其时间复杂度分析\n* **代码规范清晰**：所有代码使用 Python 编写，配有详细注释，便于回顾和面试复习\n\n## 🔍 算法分类与类比理解\n\n### 滑动窗口（Sliding Window）\n\n1. **固定窗口类** – 像刷朋友圈，每次只看连续 3 条（Leetcode 643）\n2. **可变窗口类** – 像查最长不换设备登录时间段（Leetcode 3）\n3. **双端队列类** – 像股市分析过去三天最高价（Leetcode 239）\n\n### 前缀和（Prefix Sum）\n\n1. **一维前缀和** – 像查账，从第 3 天到第 7 天花了多少钱（Leetcode 303）\n2. **二维前缀和** – 像热力图区域评分（Leetcode 304）\n3. **前缀和 + 哈希** – 像风控系统识别某段消费恰为 1000 元（Leetcode 560）\n\n### 差分（Difference）\n\n1. **一维差分** – 像安排会议，只标记“从哪天开始多了几场，从哪天结束就取消” （Leetcode 1094, 1109, 370）\n2. **二维差分** – 像地图编辑器，一次性给区域加热度、上色、加权值（Leetcode 2536, 2132, 850）\n3. **差分 + 扫描线** – 像统计人流量，从哪年开始人变多，哪年开始人变少（Leetcode 2848, 1854, 2251）\n\n### 链表（Linked List）\n\n1. **遍历类** – 像列车长从头走到尾检查每节车厢（Leetcode 1290）\n2. **删除类** – 像拆掉一节坏车厢（Leetcode 203）\n3. **插入类** – 像在第 k 节车厢后挂一节新车厢（Leetcode 707）\n4. **反转类** – 像火车掉头，所有车厢重新接方向（Leetcode 206）\n5. **快慢指针** – 像跑圈抓小偷，快慢选手相遇检测成环（Leetcode 141）\n6. **双指针类** – 像从车头车尾同时走判断是否对称（Leetcode 234）\n7. **合并类** – 像合并两条铁路（Leetcode 21）\n8. **分治类** – 像分段排序后合并火车（Leetcode 148）\n9. **综合模拟类** – 像调度站模拟合并、分裂、重排（Leetcode 2）\n\n### 二叉树（Binary Tree）\n\n1. **遍历类** – 像按顺序参观博物馆展厅（Leetcode 94）\n2. **自顶向下 DFS** – 像快递逐级分发（Leetcode 112）\n3. **自底向上 DFS** – 像成绩上报逐级汇总（Leetcode 104）\n4. **剪枝类** – 像修剪果树，只保留结果的枝条（Leetcode 814）\n5. **有递有归** – 像评比最长工作链，逐层返回结果（Leetcode 687）\n6. **二叉树直径** – 像找公交站之间最长路线（Leetcode 543）\n7. **回溯路径类** – 像森林探险，试所有路线再回头（Leetcode 257）\n8. **最近公共祖先** – 像找你和堂兄的共同祖先（Leetcode 236）\n9. **BST 操作类** – 像超市货架按价格插入/删除商品（Leetcode 701）\n10. **构造类** – 像根据图纸拼装乐高模型（Leetcode 105）\n11. **树形 DP** – 像公司决策层合并汇总最佳子策略（Leetcode 337）\n12. **层序 BFS** – 像校长通知年级主任逐层传达（Leetcode 102）\n\n### 二分搜索（Binary Search）\n\n1. **基础查找类** – 像猜数字游戏，每次对半缩小范围（Leetcode 704）\n2. **边界查找类** – 像找最左/最右空座位（Leetcode 34）\n3. **二分答案类** – 像快递公司试最小运力能否送完（Leetcode 1011）\n4. **特殊结构查找** – 像爬山找山顶（Leetcode 162）\n5. **隐式二分类** – 像在抢购活动中试预算是否能买下目标商品（Leetcode 300）\n\n### 栈（Stack）\n\n1. **基础模拟类** – 像 Ctrl+Z 撤销操作（Leetcode 844, 71）\n2. **括号合法性类** – 像代码编辑器自动配对括号（Leetcode 20, 32）\n3. **表达式解析类** – 像计算器按顺序处理加减乘除（Leetcode 150, 224, 394）\n4. **邻项消除类** – 像清理聊天记录中的重复表情（Leetcode 1047, 1209, 735）\n5. **最小/最大栈类** – 像股票系统随时告诉你买入最低价（Leetcode 155, 716）\n6. **设计类栈结构** – 像多个碗摞起来的碗塔系统（Leetcode 1172, 1381）\n7. **单调栈类** – 像找每个学生后面第一个比他高的人（Leetcode 739, 84）\n\n### 队列（Queue）\n\n1. **基础模拟类** – 像排队打卡记录最近来上课的人（Leetcode 933, 950, 649）\n2. **双端队列类** – 像剧院观众从前门或后门进出（Leetcode 2810, 2071）\n3. **循环/设计类队列结构** – 像地铁列车调度系统，环形进出站（Leetcode 622, 641, 1670, 3508）\n4. **单调队列类** – 像看过去几天的最高气温（Leetcode 239, 1438, 862）\n5. **单调队列优化 DP 类** – 像安排快递车选最划算组合方案（Leetcode 1696, 1425, 2944）\n6. **队列实现其他结构类** – 像用队列模拟栈、用栈模拟队列（Leetcode 225, 232）\n7. **队列搜索类（BFS）** – 像火灾蔓延一步步推进（Leetcode 542, 994, 1926）\n\n### 回溯（Backtracking）\n\n1. **入门模板类** – 像老式手机按键组合（Leetcode 17）\n2. **子集型** – 像打包行李，每件带或不带（Leetcode 78, 90）\n3. **划分型** – 像切蛋糕，每块都要符合口味规则（Leetcode 131, 93）\n4. **组合型** – 像买彩票，挑出 k 个数字（Leetcode 77, 39）\n5. **排列型** – 像给小朋友安排站位拍照（Leetcode 46, 47）\n6. **搜索型** – 像走迷宫找出口（Leetcode 200, 79）\n7. **含重复元素** – 像邀请同名同学时要避免重复（Leetcode 40, 90）\n8. **折半枚举** – 像两个人各自打包行李后合并检查（Leetcode 1755, 494）\n\n### 动态规划（Dynamic Programming）\n\n1. **线性 DP** – 像爬楼梯，每一步走法依赖前几步（Leetcode 70, 746）\n2. **背包型 DP** – 像打包行李，容量有限，每件物品选或不选（Leetcode 416, 494, 518）\n3. **子序列型 DP** – 像在长句中挑出关键词顺序（Leetcode 1143, 300, 72）\n4. **区间型 DP** – 像切蛋糕，每一刀都影响总成本（Leetcode 312, 1000, 887）\n5. **树形 DP** – 像公司发奖金，不能让上下级都领奖（Leetcode 337, 124）\n6. **状态机 DP** – 像炒股，不同天处于不同状态（Leetcode 122, 309, 714）\n7. **数位 DP** – 像按位统计数字，逐位决策（Leetcode 233, 357）\n8. **记忆化搜索（Top-down DP）** – 像打游戏走迷宫，走过的路径记下来避免重复（Leetcode 494, 64）\n9. **博弈型 DP** – 像两人轮流玩游戏，每步都要最优决策（Leetcode 877, 486, 1140）\n10. **状态压缩 DP** – 像开关操作，用二进制记录所有状态组合（Leetcode 691, 847）\n\n\n## 🎯 学习目标\n\n* 内化常见题型背后的**问题建模与解法模式**\n* 构建一套**可迁移、可复用的解题模板体系**\n* 提升面试中**分析问题 + 快速表达思路**的能力\n\n## 📌 仓库说明\n\n* 所有代码均使用 Python 编写，按专题或 Leetcode 题号归类\n* 部分题目包含多种实现方式（如递归 vs 迭代，暴力 vs 优化）\n* 文件命名统一，结构清晰，便于查找与复习\n* 本仓库持续更新，欢迎 star 🌟、提 issue 一起交流！\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhonkinglin%2Falgorithm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhonkinglin%2Falgorithm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhonkinglin%2Falgorithm/lists"}