From ed6a8b6037c1a89fc2b922b47bd12900e6224b32 Mon Sep 17 00:00:00 2001 From: villenaderic Date: Sun, 30 Aug 2026 18:30:00 +0800 Subject: [PATCH 1/2] Add type hints to pancake_sort function --- sorts/pancake_sort.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorts/pancake_sort.py b/sorts/pancake_sort.py index e5d600738435..035dd35520b2 100644 --- a/sorts/pancake_sort.py +++ b/sorts/pancake_sort.py @@ -9,7 +9,7 @@ """ -def pancake_sort(arr): +def pancake_sort(arr: list[int]) -> list[int]: """Sort Array with Pancake Sort. :param arr: Collection containing comparable items :return: Collection ordered in ascending order of items From 9eb3a3e55b0c89b791f83afed0037b9ebb7af19f Mon Sep 17 00:00:00 2001 From: villenaderic Date: Sun, 30 Aug 2026 21:35:46 +0800 Subject: [PATCH 2/2] Use generic type parameter to support int and float --- sorts/pancake_sort.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorts/pancake_sort.py b/sorts/pancake_sort.py index 035dd35520b2..80cb23418c47 100644 --- a/sorts/pancake_sort.py +++ b/sorts/pancake_sort.py @@ -9,7 +9,7 @@ """ -def pancake_sort(arr: list[int]) -> list[int]: +def pancake_sort[T: (int, float)](arr: list[T]) -> list[T]: """Sort Array with Pancake Sort. :param arr: Collection containing comparable items :return: Collection ordered in ascending order of items