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 c7e1909 commit 90a1f79Copy full SHA for 90a1f79
src/main/java/g0401_0500/s0494_target_sum/Solution.java
@@ -17,8 +17,8 @@ public int findTargetSumWays(int[] nums, int target) {
17
return solve(nums, sum / 2);
18
}
19
20
- private int solve(int nums[], int target) {
21
- int prev[] = new int[target + 1];
+ private int solve(int[] nums, int target) {
+ int[] prev = new int[target + 1];
22
if (nums[0] == 0) {
23
prev[0] = 2;
24
} else {
@@ -29,7 +29,7 @@ private int solve(int nums[], int target) {
29
30
int n = nums.length;
31
for (int i = 1; i < n; i++) {
32
- int curr[] = new int[target + 1];
+ int[] curr = new int[target + 1];
33
for (int j = 0; j <= target; j++) {
34
int taken = 0;
35
if (j >= nums[i]) {
0 commit comments