Skip to content

VScode cannot run code while Leetcode can run it. #614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
chloechen8 opened this issue Aug 8, 2020 · 0 comments
Open

VScode cannot run code while Leetcode can run it. #614

chloechen8 opened this issue Aug 8, 2020 · 0 comments

Comments

@chloechen8
Copy link

I can run below codes on Leetcode, however, in VScode, the codes cannot run.

🐛 Bug Report

##Example1. LC53.maximum-subarray
error message:
53.maximum-subarray.java:11: error: missing return statement } ^ 1 error
Code:
'
class Solution {
public int maxSubArray(int[] nums) {
int res = nums[0];
int sum = nums[0];

    for (int i = 1; i < nums.length; i++) {
        res = Math.max(res + nums[i], nums[i]);

        sum = Math.max(res, sum);
    }

    return sum;
}

}
'
Error:
LCerror1

LCerror1_1

##Example2: LC238.product-of-array-except-self

LCerror2

LCERROR2_2

Code: ` class Solution { public int[] productExceptSelf(int[] nums) { int len = nums.length; int[] res = new int[len]; res[0] = 1; // int temp = nums[len - 1];
    for (int i = 1; i < len; i++) {
        res[i] = nums[i - 1] * res[i - 1];
    }
    int temp = 1;
    for (int i = len - 1; i >= 0; i--) {
        res[i] *= temp;
        temp *= nums[i];
    }

    //res[0] = temp;

    return res;
}

}
`

Your Environment

Version: 1.47.3 (system setup)
Commit: 91899dcef7b8110878ea59626991a18c8a6a1b3e
Date: 2020-07-23T13:12:49.994Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18362

Leetcode version: download from vscode extension

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant