Skip to content

Commit 288543b

Browse files
committed
Adding input and return hints.
I’ve added type hints for the function parameters and return values in the examples
1 parent 35a2ed7 commit 288543b

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

data_structures/sliding_window/longest_substring_two_distinct.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def length_of_longest_substring_two_distinct(s):
1+
def length_of_longest_substring_two_distinct(string: str) -> int:
22
"""
33
Finds the length of the longest substring with at most two distinct characters.[https://www.geeksforgeeks.org/window-sliding-technique/]
44

data_structures/sliding_window/max_sum_subarray.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
def max_sum_subarray(arr, k):
1+
from typing import List
2+
3+
4+
def max_sum_subarray(array: List[int], subarray_length: int) -> int:
25
"""
36
Finds the maximum sum of a subarray of length k within the given array.[https://www.geeksforgeeks.org/window-sliding-technique/]
47

data_structures/sliding_window/min_subarray_len.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
def min_subarray_len(target, nums):
1+
from typing import List
2+
3+
4+
def min_subarray_len(target_sum: int, numbers: List[int]) -> int:
25
"""
36
Finds the minimal length of a contiguous subarray of which the sum is at least the target.[https://www.geeksforgeeks.org/window-sliding-technique/]
47

0 commit comments

Comments
 (0)