We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 413dcaa commit 904e2c9Copy full SHA for 904e2c9
README.md
@@ -45,6 +45,8 @@ Step 2. Add the dependency
45
46
<summary>展开查看</summary>
47
48
+https://leetcode-cn.com/problems/minimum-elements-to-add-to-form-a-given-sum/
49
+
50
https://leetcode.cn/problems/checking-existence-of-edge-length-limited-paths-ii/
51
52
https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-iii/
minimum-elements-to-add-to-form-a-given-sum/index.ts
@@ -0,0 +1,5 @@
1
+function minElements(nums: number[], limit: number, goal: number): number {
2
3
+ return Math.ceil(Math.abs(goal - nums.reduce((a, b) => a + b)) / limit);
4
+}
5
+export default minElements
0 commit comments