Skip to content

Commit 83197b2

Browse files
committed
ipynbs and update readme with env
1 parent 85bbb07 commit 83197b2

File tree

128 files changed

+7721
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+7721
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# LeetCode Practice Environment Generator 🚀
22

3+
# READ THIS FIRST
4+
# SETUP
5+
6+
🧱 Step 2: Create a virtual environment
7+
8+
9+
This keeps your dependencies clean and isolated.
10+
11+
```bash
12+
python3 -m venv leetcode-env
13+
```
14+
Activate it:
15+
```bash
16+
source leetcode-env/bin/activate
17+
```
18+
319
[![tests](https://img.shields.io/github/actions/workflow/status/wisarootl/leetcode-py/ci-test.yml?branch=main&label=tests&logo=github)](https://github.com/wisarootl/leetcode-py/actions/workflows/ci-test.yml)
420
[![release](https://img.shields.io/github/actions/workflow/status/wisarootl/leetcode-py/cd.yml?branch=main&label=release&logo=github)](https://github.com/wisarootl/leetcode-py/actions/workflows/cd.yml)
521
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=wisarootl_leetcode-py&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=wisarootl_leetcode-py)
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "be09b1da",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"from helpers import assert_accounts_merge, run_accounts_merge\n",
11+
"from solution import Solution"
12+
]
13+
},
14+
{
15+
"cell_type": "code",
16+
"execution_count": null,
17+
"id": "0ce59fad",
18+
"metadata": {},
19+
"outputs": [],
20+
"source": [
21+
"# Example test case\n",
22+
"accounts = [\n",
23+
" [\"John\", \"johnsmith@mail.com\", \"john_newyork@mail.com\"],\n",
24+
" [\"John\", \"johnsmith@mail.com\", \"john00@mail.com\"],\n",
25+
" [\"Mary\", \"mary@mail.com\"],\n",
26+
" [\"John\", \"johnnybravo@mail.com\"],\n",
27+
"]\n",
28+
"expected = [\n",
29+
" [\"John\", \"john00@mail.com\", \"john_newyork@mail.com\", \"johnsmith@mail.com\"],\n",
30+
" [\"Mary\", \"mary@mail.com\"],\n",
31+
" [\"John\", \"johnnybravo@mail.com\"],\n",
32+
"]"
33+
]
34+
},
35+
{
36+
"cell_type": "code",
37+
"execution_count": null,
38+
"id": "9d78522a",
39+
"metadata": {},
40+
"outputs": [],
41+
"source": [
42+
"result = run_accounts_merge(Solution, accounts)\n",
43+
"result"
44+
]
45+
},
46+
{
47+
"cell_type": "code",
48+
"execution_count": null,
49+
"id": "0767b21b",
50+
"metadata": {},
51+
"outputs": [],
52+
"source": [
53+
"assert_accounts_merge(result, expected)"
54+
]
55+
}
56+
],
57+
"metadata": {
58+
"kernelspec": {
59+
"display_name": "leetcode-py-py3.13",
60+
"language": "python",
61+
"name": "python3"
62+
}
63+
},
64+
"nbformat": 4,
65+
"nbformat_minor": 5
66+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "8678b01c",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"from helpers import assert_add_binary, run_add_binary\n",
11+
"from solution import Solution"
12+
]
13+
},
14+
{
15+
"cell_type": "code",
16+
"execution_count": null,
17+
"id": "e9fd7e3c",
18+
"metadata": {},
19+
"outputs": [],
20+
"source": [
21+
"# Example test case\n",
22+
"a = \"11\"\n",
23+
"b = \"1\"\n",
24+
"expected = \"100\""
25+
]
26+
},
27+
{
28+
"cell_type": "code",
29+
"execution_count": null,
30+
"id": "56368441",
31+
"metadata": {},
32+
"outputs": [],
33+
"source": [
34+
"result = run_add_binary(Solution, a, b)\n",
35+
"result"
36+
]
37+
},
38+
{
39+
"cell_type": "code",
40+
"execution_count": null,
41+
"id": "11a1ee58",
42+
"metadata": {},
43+
"outputs": [],
44+
"source": [
45+
"assert_add_binary(result, expected)"
46+
]
47+
}
48+
],
49+
"metadata": {
50+
"kernelspec": {
51+
"display_name": "leetcode-py-py3.13",
52+
"language": "python",
53+
"name": "python3"
54+
}
55+
},
56+
"nbformat": 4,
57+
"nbformat_minor": 5
58+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "e9abb12e",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"from helpers import assert_add_two_numbers, run_add_two_numbers\n",
11+
"from solution import Solution"
12+
]
13+
},
14+
{
15+
"cell_type": "code",
16+
"execution_count": null,
17+
"id": "93e79c47",
18+
"metadata": {},
19+
"outputs": [],
20+
"source": [
21+
"# Example test case\n",
22+
"l1_vals = [2, 4, 3]\n",
23+
"l2_vals = [5, 6, 4]\n",
24+
"expected_vals = [7, 0, 8]"
25+
]
26+
},
27+
{
28+
"cell_type": "code",
29+
"execution_count": null,
30+
"id": "affd559b",
31+
"metadata": {},
32+
"outputs": [],
33+
"source": [
34+
"result = run_add_two_numbers(Solution, l1_vals, l2_vals)\n",
35+
"result"
36+
]
37+
},
38+
{
39+
"cell_type": "code",
40+
"execution_count": null,
41+
"id": "7cbc5acf",
42+
"metadata": {},
43+
"outputs": [],
44+
"source": [
45+
"assert_add_two_numbers(result, expected_vals)"
46+
]
47+
}
48+
],
49+
"metadata": {
50+
"kernelspec": {
51+
"display_name": "leetcode-py-py3.13",
52+
"language": "python",
53+
"name": "python3"
54+
}
55+
},
56+
"nbformat": 4,
57+
"nbformat_minor": 5
58+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "0ba5e840",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"from helpers import assert_alien_order, run_alien_order\n",
11+
"from solution import Solution"
12+
]
13+
},
14+
{
15+
"cell_type": "code",
16+
"execution_count": null,
17+
"id": "0f00394c",
18+
"metadata": {},
19+
"outputs": [],
20+
"source": [
21+
"# Example test case\n",
22+
"words = [\"wrt\", \"wrf\", \"er\", \"ett\", \"rftt\"]\n",
23+
"expected = \"wertf\""
24+
]
25+
},
26+
{
27+
"cell_type": "code",
28+
"execution_count": null,
29+
"id": "4ecab642",
30+
"metadata": {},
31+
"outputs": [],
32+
"source": [
33+
"result = run_alien_order(Solution, words)\n",
34+
"result"
35+
]
36+
},
37+
{
38+
"cell_type": "code",
39+
"execution_count": null,
40+
"id": "d3869abd",
41+
"metadata": {},
42+
"outputs": [],
43+
"source": [
44+
"assert_alien_order(result, expected)"
45+
]
46+
}
47+
],
48+
"metadata": {
49+
"kernelspec": {
50+
"display_name": "leetcode-py-py3.13",
51+
"language": "python",
52+
"name": "python3"
53+
}
54+
},
55+
"nbformat": 4,
56+
"nbformat_minor": 5
57+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "01316af7",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"from helpers import assert_is_balanced, run_is_balanced\n",
11+
"from solution import Solution\n",
12+
"\n",
13+
"from leetcode_py import TreeNode"
14+
]
15+
},
16+
{
17+
"cell_type": "code",
18+
"execution_count": null,
19+
"id": "dfcc4bfd",
20+
"metadata": {},
21+
"outputs": [],
22+
"source": [
23+
"# Example test case\n",
24+
"root_list: list[int | None] = [3, 9, 20, None, None, 15, 7]\n",
25+
"expected = True"
26+
]
27+
},
28+
{
29+
"cell_type": "code",
30+
"execution_count": null,
31+
"id": "f504f639",
32+
"metadata": {},
33+
"outputs": [],
34+
"source": [
35+
"result = run_is_balanced(Solution, root_list)\n",
36+
"result"
37+
]
38+
},
39+
{
40+
"cell_type": "code",
41+
"execution_count": null,
42+
"id": "6648a660",
43+
"metadata": {},
44+
"outputs": [],
45+
"source": [
46+
"root = TreeNode.from_list(root_list)\n",
47+
"root"
48+
]
49+
},
50+
{
51+
"cell_type": "code",
52+
"execution_count": null,
53+
"id": "8a3972a2",
54+
"metadata": {},
55+
"outputs": [],
56+
"source": [
57+
"assert_is_balanced(result, expected)"
58+
]
59+
}
60+
],
61+
"metadata": {
62+
"kernelspec": {
63+
"display_name": "leetcode-py-py3.13",
64+
"language": "python",
65+
"name": "python3"
66+
}
67+
},
68+
"nbformat": 4,
69+
"nbformat_minor": 5
70+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "e16d11b3",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"from helpers import assert_calculate, run_calculate\n",
11+
"from solution import Solution"
12+
]
13+
},
14+
{
15+
"cell_type": "code",
16+
"execution_count": null,
17+
"id": "5ecc025e",
18+
"metadata": {},
19+
"outputs": [],
20+
"source": [
21+
"# Example test case\n",
22+
"s = \"(1+(4+5+2)-3)+(6+8)\"\n",
23+
"expected = 23"
24+
]
25+
},
26+
{
27+
"cell_type": "code",
28+
"execution_count": null,
29+
"id": "c0b03d19",
30+
"metadata": {},
31+
"outputs": [],
32+
"source": [
33+
"result = run_calculate(Solution, s)\n",
34+
"result"
35+
]
36+
},
37+
{
38+
"cell_type": "code",
39+
"execution_count": null,
40+
"id": "de6f6749",
41+
"metadata": {},
42+
"outputs": [],
43+
"source": [
44+
"assert_calculate(result, expected)"
45+
]
46+
}
47+
],
48+
"metadata": {
49+
"jupytext": {
50+
"formats": "ipynb,py:percent"
51+
},
52+
"kernelspec": {
53+
"display_name": "leetcode-py-py3.13",
54+
"language": "python",
55+
"name": "python3"
56+
}
57+
},
58+
"nbformat": 4,
59+
"nbformat_minor": 5
60+
}

0 commit comments

Comments
 (0)