Skip to content

Commit 26498a6

Browse files
authored
Added tests 560-1143
1 parent 8bdbfc0 commit 26498a6

File tree

8 files changed

+96
-0
lines changed

8 files changed

+96
-0
lines changed

src/main/python/g0501_0600/s0560_subarray_sum_equals_k/Solution0560.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# #Big_O_Time_O(n)_Space_O(n) #2025_07_25_Time_27_ms_(84.54%)_Space_20.34_MB_(71.80%)
33

44
from collections import defaultdict
5+
from typing import List
56

67
class Solution:
78
def subarraySum(self, nums: List[int], k: int) -> int:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import unittest
2+
from Solution0560 import Solution
3+
4+
import unittest
5+
6+
class SolutionTest(unittest.TestCase):
7+
def setUp(self):
8+
self.solution = Solution()
9+
10+
def test_subarraySum(self):
11+
self.assertEqual(self.solution.subarraySum([1, 1, 1], 2), 2)
12+
13+
def test_subarraySum2(self):
14+
self.assertEqual(self.solution.subarraySum([1, 2, 3], 3), 2)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import unittest
2+
from Solution0647 import Solution
3+
4+
import unittest
5+
6+
class SolutionTest(unittest.TestCase):
7+
def setUp(self):
8+
self.solution = Solution()
9+
10+
def test_countSubstrings(self):
11+
self.assertEqual(self.solution.countSubstrings("abc"), 3)
12+
13+
def test_countSubstrings2(self):
14+
self.assertEqual(self.solution.countSubstrings("aaa"), 6)

src/main/python/g0701_0800/s0739_daily_temperatures/Solution0739.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# #Programming_Skills_II_Day_6 #Big_O_Time_O(n)_Space_O(n)
33
# #2025_07_25_Time_105_ms_(58.04%)_Space_26.59_MB_(95.95%)
44

5+
from typing import List
6+
57
class Solution:
68
def dailyTemperatures(self, temperatures: List[int]) -> List[int]:
79
sol = [0] * len(temperatures)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import unittest
2+
from Solution0739 import Solution
3+
4+
import unittest
5+
6+
class SolutionTest(unittest.TestCase):
7+
def setUp(self):
8+
self.solution = Solution()
9+
10+
def test_dailyTemperatures(self):
11+
self.assertEqual(
12+
self.solution.dailyTemperatures([73, 74, 75, 71, 69, 72, 76, 73]),
13+
[1, 1, 4, 2, 1, 1, 0, 0]
14+
)
15+
16+
def test_dailyTemperatures2(self):
17+
self.assertEqual(
18+
self.solution.dailyTemperatures([30, 40, 50, 60]),
19+
[1, 1, 1, 0]
20+
)
21+
22+
def test_dailyTemperatures3(self):
23+
self.assertEqual(
24+
self.solution.dailyTemperatures([30, 60, 90]),
25+
[1, 1, 0]
26+
)

src/main/python/g0701_0800/s0763_partition_labels/Solution0763.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# #Data_Structure_II_Day_7_String #Big_O_Time_O(n)_Space_O(1)
33
# #2025_07_25_Time_5_ms_(53.34%)_Space_17.62_MB_(84.14%)
44

5+
from typing import List
6+
57
class Solution:
68
def partitionLabels(self, s: str) -> List[int]:
79
letters = list(s)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import unittest
2+
from Solution0763 import Solution
3+
4+
import unittest
5+
6+
class SolutionTest(unittest.TestCase):
7+
def setUp(self):
8+
self.solution = Solution()
9+
10+
def test_partitionLabels(self):
11+
self.assertEqual(
12+
self.solution.partitionLabels("ababcbacadefegdehijhklij"),
13+
[9, 7, 8]
14+
)
15+
16+
def test_partitionLabels2(self):
17+
self.assertEqual(
18+
self.solution.partitionLabels("eccbbbbdec"),
19+
[10]
20+
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import unittest
2+
from Solution1143 import Solution
3+
4+
import unittest
5+
6+
class SolutionTest(unittest.TestCase):
7+
def setUp(self):
8+
self.solution = Solution()
9+
10+
def test_longestCommonSubsequence(self):
11+
self.assertEqual(self.solution.longestCommonSubsequence("abcde", "ace"), 3)
12+
13+
def test_longestCommonSubsequence2(self):
14+
self.assertEqual(self.solution.longestCommonSubsequence("abc", "abc"), 3)
15+
16+
def test_longestCommonSubsequence3(self):
17+
self.assertEqual(self.solution.longestCommonSubsequence("abc", "def"), 0)

0 commit comments

Comments
 (0)