Add your description here
Project description
leetcodelib
📖 简介
leetcodelib 是一个轻量级的 Python 工具库,旨在解决 LeetCode 刷题时本地输入与题目要求数据结构不一致的痛点。
在 LeetCode 上,题目通常以数组(如 [1, 2, 3])的形式给出输入,但算法代码却需要处理 链表 (ListNode) 或 二叉树 (TreeNode) 对象。leetcodelib 提供了高效的序列化与反序列化工具,助你在本地 IDE(如 PyCharm, VS Code)中轻松构建测试用例,享受断点调试的便利。
✨ 为什么选择 leetcodelib?
- 🚀 开箱即用:零依赖,纯 Python 实现,安装即用
- 🌳 完美还原:完美支持 LeetCode 的层序遍历(BFS)二叉树格式(含
null处理) - 🔗 链表神器:一行代码实现数组与链表的相互转换
- ⚡ 调试友好:提供将对象转回数组的函数,方便
print验证结果 - 📝 类型提示:完整的 Type Hinting,让 IDE 智能补全更顺畅
- 🧪 测试覆盖:经过大量边界条件测试(空树、单节点、不平衡树)
🚀 快速开始
安装
pip install leetcodelib
一分钟上手
from leetcodelib import *
# 1. 构造输入:将 LeetCode 数组转为二叉树对象
root = build_tree([3, 9, 20, None, None, 15, 7])
# 2. 构造输入:将 LeetCode 数组转为链表对象
root = build_link_list([3, 9, 1, 2])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file leetcodelib-0.1.0.tar.gz.
File metadata
- Download URL: leetcodelib-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e264b02fa5f2df1fd1dc724fddc1d9ba2d6c948849cafa2d7b5010a4b18891c
|
|
| MD5 |
7581822194d39af26411587ce8dbfd1f
|
|
| BLAKE2b-256 |
5e21cfcfd164c1df439f1d3a843aa3e50871a679f43d57c503e5200613bb66c7
|
Provenance
The following attestation bundles were made for leetcodelib-0.1.0.tar.gz:
Publisher:
workflow.yml on ciaoyizhen/leetcodelib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
leetcodelib-0.1.0.tar.gz -
Subject digest:
2e264b02fa5f2df1fd1dc724fddc1d9ba2d6c948849cafa2d7b5010a4b18891c - Sigstore transparency entry: 833741402
- Sigstore integration time:
-
Permalink:
ciaoyizhen/leetcodelib@9611d621492ea8ce578cf1320a3ae15d23c00118 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ciaoyizhen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@9611d621492ea8ce578cf1320a3ae15d23c00118 -
Trigger Event:
push
-
Statement type:
File details
Details for the file leetcodelib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: leetcodelib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d25fc135365725cbe76a9fe6c86a57bab0707aa84517f851e5c651cb057eaa6f
|
|
| MD5 |
f823bbf230bc71860921bc2d6365677f
|
|
| BLAKE2b-256 |
ce3e237f99d2d0fa0ea4a8e66e1bf31e8227a05e2449445480bbab3d20b57a56
|
Provenance
The following attestation bundles were made for leetcodelib-0.1.0-py3-none-any.whl:
Publisher:
workflow.yml on ciaoyizhen/leetcodelib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
leetcodelib-0.1.0-py3-none-any.whl -
Subject digest:
d25fc135365725cbe76a9fe6c86a57bab0707aa84517f851e5c651cb057eaa6f - Sigstore transparency entry: 833741404
- Sigstore integration time:
-
Permalink:
ciaoyizhen/leetcodelib@9611d621492ea8ce578cf1320a3ae15d23c00118 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ciaoyizhen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@9611d621492ea8ce578cf1320a3ae15d23c00118 -
Trigger Event:
push
-
Statement type: