From fb45db62ceb33a5c1c11070ed2edb54d51363a24 Mon Sep 17 00:00:00 2001 From: rajeshwariramya <103486631+rajeshwariramya@users.noreply.github.com> Date: Sat, 19 Oct 2024 10:07:28 +0530 Subject: [PATCH] Update Divide_Players_Into_Teams_Of_Equal_Skills.py --- Python/Divide_Players_Into_Teams_Of_Equal_Skills.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Python/Divide_Players_Into_Teams_Of_Equal_Skills.py b/Python/Divide_Players_Into_Teams_Of_Equal_Skills.py index e483c1a..c83dd79 100644 --- a/Python/Divide_Players_Into_Teams_Of_Equal_Skills.py +++ b/Python/Divide_Players_Into_Teams_Of_Equal_Skills.py @@ -1,3 +1,5 @@ +from typing import List + class Solution: def dividePlayers(self, skill: List[int]) -> int: # Step 1: Sort the skill array @@ -11,7 +13,8 @@ def dividePlayers(self, skill: List[int]) -> int: # Check if the sum of current pair matches the required total_skill if skill[i] + skill[-i - 1] != total_skill: return -1 # Invalid configuration, return -1 + # Calculate the chemistry (product of pair) and add it to the sum chemistry_sum += skill[i] * skill[-i - 1] - return chemistry_sum # Return total chemistry \ No newline at end of file + return chemistry_sum # Return total chemistry