-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Description
Bug Report for https://neetcode.io/problems/range-sum-query-immutable
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
I think there's a bug with Java. When I run the code I see this error:
Main.java:-4: error: package javafx.util does not exist
import javafx.util.*;
^
1 error
But I don't have any imports in the code. And I don’t think any kind of import is needed for this code.
The problem occurs both on Run and on Submit.
class NumArray {
int[] prefix;
public NumArray(int[] nums) {
this.prefix = new int[nums.length];
int tot = 0;
for (int i = 0; i < nums.length; i++) {
tot += nums[i];
prefix[i] = tot;
}
}
public int sumRange(int left, int right) {
int preRight = prefix[right];
int preLeft = left > 0 ? prefix[left - 1] : 0;
return preRight - preLeft;
}
}
/**
* Your NumArray object will be instantiated and called as such:
* NumArray obj = new NumArray(nums);
* int param_1 = obj.sumRange(left,right);
*/
AI suggested fix says:
The compilation error was not actually in your logic, but rather an environment issue where the javafx.util.* package was missing from the execution environment.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels