-
Notifications
You must be signed in to change notification settings - Fork 382
Closed
Labels
Description
LeetCode Username
piusz
Problem number, title, and link
2834.Find the Minimum Possible Sum of a Beautiful Array https://leetcode.cn/problems/find-the-minimum-possible-sum-of-a-beautiful-array/description/
Category of the bug
- Missing test Case (Incorrect/Inefficient Code getting accepted because of missing test cases)
Description of the bug
When solving using the formula method and
Example test case : n = 100000000, target = 1000000000.
Language used for code
Java
Code used for Submit/Run operation
class Solution {
public int minimumPossibleSum(int n, int target) {
long res = 0L;
int mod = 1000_000_007;
int split = target / 2;
if (split >= n) {
// Where the problem occurs
res = (1 + n) * n / 2;
} else {
res = 1L * (1 + split) * split / 2 + (0L + target + target + n - split - 1) * (n - split) / 2;
}
return (int)(res % mod);
}
}
Expected behavior
Example test case : n = 100000000, target = 1000000000.
This error code can pass all existing test cases, but cannot pass the above test case.