Skip to main content

Add your description here

Project description

leetcodelib

PyPI version Python Version License Downloads

专为 LeetCode 刷题设计的本地调试神器

快速开始功能特性API 文档示例贡献


📖 简介

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

leetcodelib-0.1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

leetcodelib-0.1.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

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

Hashes for leetcodelib-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2e264b02fa5f2df1fd1dc724fddc1d9ba2d6c948849cafa2d7b5010a4b18891c
MD5 7581822194d39af26411587ce8dbfd1f
BLAKE2b-256 5e21cfcfd164c1df439f1d3a843aa3e50871a679f43d57c503e5200613bb66c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for leetcodelib-0.1.0.tar.gz:

Publisher: workflow.yml on ciaoyizhen/leetcodelib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for leetcodelib-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d25fc135365725cbe76a9fe6c86a57bab0707aa84517f851e5c651cb057eaa6f
MD5 f823bbf230bc71860921bc2d6365677f
BLAKE2b-256 ce3e237f99d2d0fa0ea4a8e66e1bf31e8227a05e2449445480bbab3d20b57a56

See more details on using hashes here.

Provenance

The following attestation bundles were made for leetcodelib-0.1.0-py3-none-any.whl:

Publisher: workflow.yml on ciaoyizhen/leetcodelib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page