We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fd08a52 commit 132d5f1Copy full SHA for 132d5f1
1276. 不浪费原料的汉堡制作方案.js
@@ -0,0 +1,16 @@
1
+/**
2
+ * @param {number} tomatoSlices
3
+ * @param {number} cheeseSlices
4
+ * @return {number[]}
5
+ */
6
+var numOfBurgers = function (tomatoSlices, cheeseSlices) {
7
+ if (tomatoSlices % 2 !== 0) {
8
+ return [];
9
+ }
10
+ const maxJumbo = Math.floor(tomatoSlices / 4);
11
+ const maxSmall = Math.floor(tomatoSlices / 2);
12
+ if (cheeseSlices > maxSmall || cheeseSlices < maxJumbo) {
13
14
15
+ return [maxSmall - cheeseSlices, Math.floor((tomatoSlices - (maxSmall - cheeseSlices) * 4) / 2)];
16
+};
0 commit comments