Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
coverage:
ignore:
- "**/playground.py"
status:
project:
default:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci-pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
Expand Down
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ repos:
id: gitleaks
- repo: local
hooks:
- id: sync-submodules
name: Sync git submodules
entry: bash -c 'output=$(git submodule update --init --recursive --remote 2>&1); [ -z "$output" ]'
language: system
always_run: true
pass_filenames: false
- id: nb-to-py
name: convert notebooks to python
entry: make nb-to-py
language: system
pass_filenames: false
- id: lint
name: lint
entry: make lint
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ p-gen:
p-del:
rm -rf leetcode/$(PROBLEM)

# Convert all notebooks to .py files and delete .ipynb for better version control
nb-to-py:
@echo "Converting all .ipynb files in leetcode/ to .py files..."
@find leetcode -name "*.ipynb" -exec poetry run jupytext --to py:percent {} \;
@find leetcode -name "*.ipynb" -delete
@echo "Conversion complete. All .ipynb files converted to .py and deleted."

# Generate All Problems - useful for people who fork this repo
gen-all-problems:
@echo "This will DELETE all existing problems and regenerate from JSON templates."
Expand Down
102 changes: 0 additions & 102 deletions leetcode/accounts_merge/playground.ipynb

This file was deleted.

38 changes: 38 additions & 0 deletions leetcode/accounts_merge/playground.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.17.3
# kernelspec:
# display_name: leetcode-py-py3.13
# language: python
# name: python3
# ---

# %%
from helpers import assert_accounts_merge, run_accounts_merge
from solution import Solution

# %%
# Example test case
accounts = [
["John", "johnsmith@mail.com", "john_newyork@mail.com"],
["John", "johnsmith@mail.com", "john00@mail.com"],
["Mary", "mary@mail.com"],
["John", "johnnybravo@mail.com"],
]
expected = [
["John", "john00@mail.com", "john_newyork@mail.com", "johnsmith@mail.com"],
["Mary", "mary@mail.com"],
["John", "johnnybravo@mail.com"],
]

# %%
result = run_accounts_merge(Solution, accounts)
result

# %%
assert_accounts_merge(result, expected)
69 changes: 0 additions & 69 deletions leetcode/add_binary/playground.ipynb

This file was deleted.

30 changes: 30 additions & 0 deletions leetcode/add_binary/playground.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.17.3
# kernelspec:
# display_name: leetcode-py-py3.13
# language: python
# name: python3
# ---

# %%
from helpers import assert_add_binary, run_add_binary
from solution import Solution

# %%
# Example test case
a = "11"
b = "1"
expected = "100"

# %%
result = run_add_binary(Solution, a, b)
result

# %%
assert_add_binary(result, expected)
Loading