Skip to content

Commit 485b723

Browse files
committed
Fix solution links in Anki
1 parent ff1faeb commit 485b723

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

leetcode_study_tool/formatters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def format_anki(url: str, slug: str, data: dict):
110110
format_solution_link(slug, solution["id"])
111111
for solution in data["solutions"]
112112
],
113+
is_link=True,
113114
)
114115

115116
problem += ";"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "leetcode-study-tool"
7-
version = "1.2.2"
7+
version = "1.2.4"
88
description = "A tool for studying Leetcode with Python"
99
authors = [{name="John Sutor", email="johnsutor3@gmail.com" }]
1010
license = {file = "LICENSE.txt"}

tests/test_formatters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class TestFormatters(unittest.TestCase):
99
def setUp(self) -> None:
1010
super().setUp()
11-
self.correct_anki_formatted_two_sum_problem = ' <h1> <a href="https://leetcode.com/problems/two-sum/">1. Two Sum</a> </h1> <p> <p>Given an array of integers <code>nums</code>&nbsp;and an integer <code>target</code>, return <em>indices of the two numbers such that they add up to <code>target</code></em>.</p><p>You may assume that each input would have <strong><em>exactly</em> one solution</strong>, and you may not use the <em>same</em> element twice.</p><p>You can return the answer in any order.</p><p>&nbsp;</p><p><strong class="example">Example 1:</strong></p><pre><strong>Input:</strong> nums = [2,7,11,15], target = 9<strong>Output:</strong> [0,1]<strong>Explanation:</strong> Because nums[0] + nums[1] == 9, we return [0, 1].</pre><p><strong class="example">Example 2:</strong></p><pre><strong>Input:</strong> nums = [3,2,4], target = 6<strong>Output:</strong> [1,2]</pre><p><strong class="example">Example 3:</strong></p><pre><strong>Input:</strong> nums = [3,3], target = 6<strong>Output:</strong> [0,1]</pre><p>&nbsp;</p><p><strong>Constraints:</strong></p><ul>\t<li><code>2 &lt;= nums.length &lt;= 10<sup>4</sup></code></li>\t<li><code>-10<sup>9</sup> &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>\t<li><code>-10<sup>9</sup> &lt;= target &lt;= 10<sup>9</sup></code></li>\t<li><strong>Only one valid answer exists.</strong></li></ul><p>&nbsp;</p><strong>Follow-up:&nbsp;</strong>Can you come up with an algorithm that is less than <code>O(n<sup>2</sup>)</code><font face="monospace">&nbsp;</font>time complexity? <p> <strong>Tags:</strong><br> <ul> <li>Array</li><li>Hash Table</li> </ul> ;<strong>NeetCode Solution:</strong><br><a href="https://youtube.com/watch?v=KLlXCFG5TnA">Two Sum - Leetcode 1 - HashMap - Python</a></li><br><br> <strong>LeetCode User Solutions:</strong><br> <ul> <li>https://leetcode.com/problems/two-sum/solutions/2/1/</li><li>https://leetcode.com/problems/two-sum/solutions/3/1/</li><li>https://leetcode.com/problems/two-sum/solutions/4/1/</li><li>https://leetcode.com/problems/two-sum/solutions/6/1/</li><li>https://leetcode.com/problems/two-sum/solutions/7/1/</li><li>https://leetcode.com/problems/two-sum/solutions/8/1/</li><li>https://leetcode.com/problems/two-sum/solutions/9/1/</li><li>https://leetcode.com/problems/two-sum/solutions/10/1/</li><li>https://leetcode.com/problems/two-sum/solutions/11/1/</li><li>https://leetcode.com/problems/two-sum/solutions/12/1/</li> </ul> ;array hash-table'
11+
self.correct_anki_formatted_two_sum_problem = ' <h1> <a href="https://leetcode.com/problems/two-sum/">1. Two Sum</a> </h1> <p> <p>Given an array of integers <code>nums</code>&nbsp;and an integer <code>target</code>, return <em>indices of the two numbers such that they add up to <code>target</code></em>.</p><p>You may assume that each input would have <strong><em>exactly</em> one solution</strong>, and you may not use the <em>same</em> element twice.</p><p>You can return the answer in any order.</p><p>&nbsp;</p><p><strong class="example">Example 1:</strong></p><pre><strong>Input:</strong> nums = [2,7,11,15], target = 9<strong>Output:</strong> [0,1]<strong>Explanation:</strong> Because nums[0] + nums[1] == 9, we return [0, 1].</pre><p><strong class="example">Example 2:</strong></p><pre><strong>Input:</strong> nums = [3,2,4], target = 6<strong>Output:</strong> [1,2]</pre><p><strong class="example">Example 3:</strong></p><pre><strong>Input:</strong> nums = [3,3], target = 6<strong>Output:</strong> [0,1]</pre><p>&nbsp;</p><p><strong>Constraints:</strong></p><ul>\t<li><code>2 &lt;= nums.length &lt;= 10<sup>4</sup></code></li>\t<li><code>-10<sup>9</sup> &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>\t<li><code>-10<sup>9</sup> &lt;= target &lt;= 10<sup>9</sup></code></li>\t<li><strong>Only one valid answer exists.</strong></li></ul><p>&nbsp;</p><strong>Follow-up:&nbsp;</strong>Can you come up with an algorithm that is less than <code>O(n<sup>2</sup>)</code><font face="monospace">&nbsp;</font>time complexity? <p> <strong>Tags:</strong><br> <ul> <li>Array</li><li>Hash Table</li> </ul> ;<strong>NeetCode Solution:</strong><br><a href="https://youtube.com/watch?v=KLlXCFG5TnA">Two Sum - Leetcode 1 - HashMap - Python</a></li><br><br> <strong>LeetCode User Solutions:</strong><br> <ul> <li><a href=https://leetcode.com/problems/two-sum/solutions/2/1/>https://leetcode.com/problems/two-sum/solutions/2/1/</a></li><li><a href=https://leetcode.com/problems/two-sum/solutions/3/1/>https://leetcode.com/problems/two-sum/solutions/3/1/</a></li><li><a href=https://leetcode.com/problems/two-sum/solutions/4/1/>https://leetcode.com/problems/two-sum/solutions/4/1/</a></li><li><a href=https://leetcode.com/problems/two-sum/solutions/6/1/>https://leetcode.com/problems/two-sum/solutions/6/1/</a></li><li><a href=https://leetcode.com/problems/two-sum/solutions/7/1/>https://leetcode.com/problems/two-sum/solutions/7/1/</a></li><li><a href=https://leetcode.com/problems/two-sum/solutions/8/1/>https://leetcode.com/problems/two-sum/solutions/8/1/</a></li><li><a href=https://leetcode.com/problems/two-sum/solutions/9/1/>https://leetcode.com/problems/two-sum/solutions/9/1/</a></li><li><a href=https://leetcode.com/problems/two-sum/solutions/10/1/>https://leetcode.com/problems/two-sum/solutions/10/1/</a></li><li><a href=https://leetcode.com/problems/two-sum/solutions/11/1/>https://leetcode.com/problems/two-sum/solutions/11/1/</a></li><li><a href=https://leetcode.com/problems/two-sum/solutions/12/1/>https://leetcode.com/problems/two-sum/solutions/12/1/</a></li> </ul> ;array hash-table'
1212

1313
def test_format_list_element(self):
1414
self.assertEqual(

0 commit comments

Comments
 (0)