Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
49e4da0
all is correct
artemmalanin979-create Sep 23, 2025
a05ced8
corrected task7
artemmalanin979-create Sep 25, 2025
d88f60b
corrected task6
artemmalanin979-create Sep 25, 2025
fc44ae2
format tasks
artemmalanin979-create Sep 25, 2025
82e8210
first variant
artemmalanin979-create Oct 7, 2025
571c675
my try
artemmalanin979-create Oct 7, 2025
ec44b4f
les02 task6 reformatted
artemmalanin979-create Oct 7, 2025
a6c50fe
tasks for lesson04
artemmalanin979-create Oct 16, 2025
7897146
task5 is slow, but i dont know how do this faster
artemmalanin979-create Oct 16, 2025
922afc1
task04
artemmalanin979-create Oct 16, 2025
d28247a
zaminka
artemmalanin979-create Oct 18, 2025
5d3e069
check also lesson 4 pls
artemmalanin979-create Oct 18, 2025
df7eb79
look good
artemmalanin979-create Oct 30, 2025
e1830ab
m.a. 514
artemmalanin979-create Nov 13, 2025
081f161
a.m.
artemmalanin979-create Nov 13, 2025
da0dcce
sleep
artemmalanin979-create Nov 30, 2025
1efb67c
hw1
artemmalanin979-create Nov 30, 2025
afb853d
vector
artemmalanin979-create Dec 5, 2025
fa27e36
all for green
artemmalanin979-create Dec 5, 2025
7a79feb
cache
artemmalanin979-create Dec 6, 2025
36ee0fc
commit forget
artemmalanin979-create Dec 6, 2025
a705703
12 lesson
artemmalanin979-create Dec 13, 2025
6579590
lesson03 complited
artemmalanin979-create Mar 6, 2026
ac696df
after ruff
artemmalanin979-create Mar 6, 2026
bdb2837
Merge branch 'EvgrafovMichail:main' into main
artemmalanin979-create Mar 7, 2026
1c36d8a
problems
artemmalanin979-create Mar 7, 2026
cc8a146
Merge branch 'EvgrafovMichail:main' into main
artemmalanin979-create Mar 13, 2026
337f101
solution of pad_image function
artemmalanin979-create Mar 13, 2026
64546db
solution of blur_image function
artemmalanin979-create Mar 13, 2026
980611e
solution of dominant_color function
artemmalanin979-create Mar 13, 2026
d5cec57
upd task1 and add task2 solution
artemmalanin979-create Mar 13, 2026
83b3e2e
upd task1 blur
artemmalanin979-create Mar 13, 2026
c90f6a0
upd task2
artemmalanin979-create Mar 13, 2026
4f788a0
Merge branch 'EvgrafovMichail:main' into main
artemmalanin979-create Mar 15, 2026
70715ee
tasks completed
artemmalanin979-create Mar 20, 2026
94a2572
Merge branch 'EvgrafovMichail:main' into main
artemmalanin979-create Apr 10, 2026
cc07193
complite tasks
artemmalanin979-create Apr 10, 2026
b5b9721
Merge branch 'EvgrafovMichail:main' into main
artemmalanin979-create Apr 17, 2026
7aa6991
solution of lesson08
artemmalanin979-create Apr 17, 2026
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
16 changes: 8 additions & 8 deletions deprecated_tests/sem01/tests/test_lesson02_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


@pytest.mark.parametrize(
"num, result_expected",
"num, result_expected",
(
pytest.param(
0,
Expand Down Expand Up @@ -44,7 +44,7 @@ def test_get_factorial(num: int, result_expected: int) -> None:


@pytest.mark.parametrize(
"num, result_expected",
"num, result_expected",
(
pytest.param(
0,
Expand Down Expand Up @@ -83,7 +83,7 @@ def test_get_doubled_factorial(num: int, result_expected: int) -> None:


@pytest.mark.parametrize(
"num, result_expected",
"num, result_expected",
(
pytest.param(
1,
Expand Down Expand Up @@ -125,7 +125,7 @@ def test_get_amount_of_ways_to_climb(


@pytest.mark.parametrize(
"num, result_expected",
"num, result_expected",
(
pytest.param(
1,
Expand Down Expand Up @@ -162,7 +162,7 @@ def test_get_multiplications_amount(


@pytest.mark.parametrize(
"num1, num2, result_expected",
"num1, num2, result_expected",
(
pytest.param(
1,
Expand Down Expand Up @@ -229,7 +229,7 @@ def test_get_gcd(


@pytest.mark.parametrize(
"num, result_expected",
"num, result_expected",
(
pytest.param(
1,
Expand Down Expand Up @@ -273,10 +273,10 @@ def test_get_sum_of_prime_divisors(num: int, result_expected: int) -> None:


@pytest.mark.parametrize(
"num, result_expected",
"num, result_expected",
(
pytest.param(
-10**10,
-(10**10),
False,
id="negative-ten-billion",
),
Expand Down
214 changes: 103 additions & 111 deletions deprecated_tests/sem01/tests/test_lesson04_tasks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pytest
import pytest
import random

from solutions.sem01.lesson04.task1 import is_arithmetic_progression
Expand All @@ -8,152 +8,144 @@
from solutions.sem01.lesson04.task5 import find_row_with_most_ones
from solutions.sem01.lesson04.task6 import count_cycles

@pytest.mark.parametrize("lst, expected", [
pytest.param([], True, id="empty_list"),
pytest.param([5], True, id="single_element"),
pytest.param([1, 3], True, id="two_elements"),
pytest.param([3, 1], True, id="two_elements_unsorted"),
pytest.param([1, 3, 5, 7], True, id="already_sorted_ap"),
pytest.param([3, 1, 5, 7], True, id="unsorted_ap"),
pytest.param([1, 2, 4], False, id="not_ap"),
pytest.param([10, 5, 0, -5], True, id="negative_difference"),
pytest.param([1, 1, 1, 1], True, id="constant_sequence"),
pytest.param([1, 2, 3, 5], False, id="almost_ap_but_not"),
pytest.param([0, 0, 1], False, id="two_same_one_different"),
pytest.param([10**5 + i*10**2 for i in range(1000)], True, id="long_list_true"),
pytest.param([10**5 + i*10**2 for i in range(999)] + [1], False, id="long_list_false"),
])

@pytest.mark.parametrize(
"lst, expected",
[
pytest.param([], True, id="empty_list"),
pytest.param([5], True, id="single_element"),
pytest.param([1, 3], True, id="two_elements"),
pytest.param([3, 1], True, id="two_elements_unsorted"),
pytest.param([1, 3, 5, 7], True, id="already_sorted_ap"),
pytest.param([3, 1, 5, 7], True, id="unsorted_ap"),
pytest.param([1, 2, 4], False, id="not_ap"),
pytest.param([10, 5, 0, -5], True, id="negative_difference"),
pytest.param([1, 1, 1, 1], True, id="constant_sequence"),
pytest.param([1, 2, 3, 5], False, id="almost_ap_but_not"),
pytest.param([0, 0, 1], False, id="two_same_one_different"),
pytest.param([10**5 + i * 10**2 for i in range(1000)], True, id="long_list_true"),
pytest.param([10**5 + i * 10**2 for i in range(999)] + [1], False, id="long_list_false"),
],
)
def test_is_arithmetic_progression_parametrized(lst, expected):
if len(lst) > 500:
random.shuffle(lst)
assert is_arithmetic_progression(lst) == expected


@pytest.mark.parametrize("intervals, expected", [
pytest.param([], [], id="empty"),
pytest.param([[1, 3]], [[1, 3]], id="single_interval"),
pytest.param([[10, 13], [1, 3], [2, 6], [8, 10], [15, 18]], [[1, 6], [8, 13], [15, 18]], id="classic_merge"),
pytest.param([[1, 4], [4, 5]], [[1, 5]], id="touching_intervals"),
pytest.param([[1, 4], [2, 3]], [[1, 4]], id="nested_interval"),
pytest.param([[5, 7], [1, 3], [15, 20], [0, 0], [2, 4], [6, 10], [0, 2]], [[0, 4], [5, 10], [15, 20]], id="unsorted_input"),
pytest.param([[1, 2], [3, 4], [5, 6]], [[1, 2], [3, 4], [5, 6]], id="no_overlap"),
pytest.param([[1, 10], [2, 3], [4, 5], [6, 7]], [[1, 10]], id="all_merged"),
])
@pytest.mark.parametrize(
"intervals, expected",
[
pytest.param([], [], id="empty"),
pytest.param([[1, 3]], [[1, 3]], id="single_interval"),
pytest.param(
[[10, 13], [1, 3], [2, 6], [8, 10], [15, 18]],
[[1, 6], [8, 13], [15, 18]],
id="classic_merge",
),
pytest.param([[1, 4], [4, 5]], [[1, 5]], id="touching_intervals"),
pytest.param([[1, 4], [2, 3]], [[1, 4]], id="nested_interval"),
pytest.param(
[[5, 7], [1, 3], [15, 20], [0, 0], [2, 4], [6, 10], [0, 2]],
[[0, 4], [5, 10], [15, 20]],
id="unsorted_input",
),
pytest.param([[1, 2], [3, 4], [5, 6]], [[1, 2], [3, 4], [5, 6]], id="no_overlap"),
pytest.param([[1, 10], [2, 3], [4, 5], [6, 7]], [[1, 10]], id="all_merged"),
],
)
def test_merge_intervals(intervals, expected):
assert merge_intervals(intervals) == expected

@pytest.mark.parametrize("nums, expected", [
pytest.param([2, 2, 1], 1, id="simple_case"),
pytest.param([4, 1, 2, 1, 2], 4, id="middle_single"),
pytest.param([1], 1, id="single_element"),
pytest.param([100, 200, 300, 200, 100], 300, id="large_numbers"),
pytest.param([0, 1, 0], 1, id="with_zero"),
pytest.param([7, 8, 9, 8, 7], 9, id="unsorted"),
pytest.param([i + 10**5 for i in range(500)] + [i + 10**5 for i in range(500)] + [69], 69, id="long_list"),
])

@pytest.mark.parametrize(
"nums, expected",
[
pytest.param([2, 2, 1], 1, id="simple_case"),
pytest.param([4, 1, 2, 1, 2], 4, id="middle_single"),
pytest.param([1], 1, id="single_element"),
pytest.param([100, 200, 300, 200, 100], 300, id="large_numbers"),
pytest.param([0, 1, 0], 1, id="with_zero"),
pytest.param([7, 8, 9, 8, 7], 9, id="unsorted"),
pytest.param(
[i + 10**5 for i in range(500)] + [i + 10**5 for i in range(500)] + [69],
69,
id="long_list",
),
],
)
def test_find_single_number(nums, expected):
assert find_single_number(nums) == expected

@pytest.mark.parametrize("input_list, expected_list, expected_index", [
pytest.param([0, 1, 0, 3, 12], [1, 3, 12, 0, 0], 3, id="basic"),
pytest.param([0, 0, 1], [1, 0, 0], 1, id="zeros_first"),
pytest.param([1, 2, 3], [1, 2, 3], 3, id="no_zeros"),
pytest.param([0, 0, 0], [0, 0, 0], 0, id="all_zeros"),
pytest.param([1, 0, 2, 0, 3, 0], [1, 2, 3, 0, 0, 0], 3, id="interleaved"),
pytest.param([], [], 0, id="empty"),
pytest.param([0], [0], 0, id="single_zero"),
pytest.param([42], [42], 1, id="single_nonzero"),
])

@pytest.mark.parametrize(
"input_list, expected_list, expected_index",
[
pytest.param([0, 1, 0, 3, 12], [1, 3, 12, 0, 0], 3, id="basic"),
pytest.param([0, 0, 1], [1, 0, 0], 1, id="zeros_first"),
pytest.param([1, 2, 3], [1, 2, 3], 3, id="no_zeros"),
pytest.param([0, 0, 0], [0, 0, 0], 0, id="all_zeros"),
pytest.param([1, 0, 2, 0, 3, 0], [1, 2, 3, 0, 0, 0], 3, id="interleaved"),
pytest.param([], [], 0, id="empty"),
pytest.param([0], [0], 0, id="single_zero"),
pytest.param([42], [42], 1, id="single_nonzero"),
],
)
def test_move_zeros_to_end_parametrized(input_list, expected_list, expected_index):
arr = input_list[:]
result_index = move_zeros_to_end(arr)
assert arr == expected_list
assert result_index == expected_index


@pytest.mark.parametrize("matrix, expected_row", [
pytest.param(
[[0, 0, 1, 1],
[0, 1, 1, 1],
[0, 0, 0, 1],
[1, 1, 1, 1],
[0, 1, 1, 1]],
3,
id="classic"
),
pytest.param(
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
0,
id="all_zeros"
),
pytest.param(
[[1, 1, 1],
[1, 1, 1],
[1, 1, 1]],
0,
id="all_ones_first"
),
pytest.param(
[[0, 1],
[1, 1]],
1,
id="two_rows"
),
pytest.param(
[[0]],
0,
id="single_zero"
),
pytest.param(
[[1]],
0,
id="single_one"
),
pytest.param(
[],
0,
id="empty_matrix"
),
pytest.param(
[[0, 0, 1],
[0, 1, 1],
[0, 1, 1]],
1,
id="tie"
),
])
@pytest.mark.parametrize(
"matrix, expected_row",
[
pytest.param(
[[0, 0, 1, 1], [0, 1, 1, 1], [0, 0, 0, 1], [1, 1, 1, 1], [0, 1, 1, 1]], 3, id="classic"
),
pytest.param([[0, 0, 0], [0, 0, 0], [0, 0, 0]], 0, id="all_zeros"),
pytest.param([[1, 1, 1], [1, 1, 1], [1, 1, 1]], 0, id="all_ones_first"),
pytest.param([[0, 1], [1, 1]], 1, id="two_rows"),
pytest.param([[0]], 0, id="single_zero"),
pytest.param([[1]], 0, id="single_one"),
pytest.param([], 0, id="empty_matrix"),
pytest.param([[0, 0, 1], [0, 1, 1], [0, 1, 1]], 1, id="tie"),
],
)
def test_find_row_with_most_ones(matrix, expected_row):
assert find_row_with_most_ones(matrix) == expected_row


def test_find_row_with_most_ones_big_data():
size = 10000
matrix = [[0]*size for i in range(size)]
matrix[size-1][size-1] = 1
matrix = [[0] * size for i in range(size)]
matrix[size - 1][size - 1] = 1

for i in range(50):
assert find_row_with_most_ones(matrix) == 9999

size = 10000
matrix = [[1]*size for i in range(size)]
matrix = [[1] * size for i in range(size)]
matrix[0][0] = 0

for i in range(50):
assert find_row_with_most_ones(matrix) == 1


@pytest.mark.parametrize("input_arr, expected", [
pytest.param([0], 1, id="self_loop"),
pytest.param([1, 0], 1, id="two_cycle"),
pytest.param([1, 2, 0], 1, id="three_cycle"),
pytest.param([0, 1, 2], 3, id="three_self_loops"),
pytest.param([1, 0, 3, 2], 2, id="two_2_cycles"),
pytest.param([2, 0, 1, 4, 3], 2, id="mixed_cycles"),
pytest.param([10, 6, 2, 9, 4, 0, 3, 8, 7, 1, 5], 5, id="mixed_cycles"),
pytest.param([], 0, id="empty"),
])
@pytest.mark.parametrize(
"input_arr, expected",
[
pytest.param([0], 1, id="self_loop"),
pytest.param([1, 0], 1, id="two_cycle"),
pytest.param([1, 2, 0], 1, id="three_cycle"),
pytest.param([0, 1, 2], 3, id="three_self_loops"),
pytest.param([1, 0, 3, 2], 2, id="two_2_cycles"),
pytest.param([2, 0, 1, 4, 3], 2, id="mixed_cycles"),
pytest.param([10, 6, 2, 9, 4, 0, 3, 8, 7, 1, 5], 5, id="mixed_cycles"),
pytest.param([], 0, id="empty"),
],
)
def test_count_cycles(input_arr, expected):
arr = input_arr[:]
assert count_cycles(arr) == expected
Loading
Loading