[ya-day1] tshortChooser solution for base case

This commit is contained in:
2024-10-27 23:55:17 +03:00
parent 17f0be347b
commit 46779a7da5
2 changed files with 36 additions and 2 deletions
+10 -1
View File
@@ -4,5 +4,14 @@ export function tiShortChoser(
sBlue: number,
sRed: number,
) {
return [3, 4];
let tishort = tBlue > tRed ? tRed + 1 : tBlue + 1;
let socks = sBlue > sRed ? sRed + 1 : sBlue + 1;
if (tBlue === tRed) tishort = tRed + 1;
if (sBlue === sRed) socks = sRed + 1;
if (tBlue === tRed && tBlue === 1) tishort = 2;
if (sBlue === sRed && sBlue === 1) socks = 2;
return [tishort, socks].join(" ");
}