I cannot submit or test my code properly when I am working on Question 59.
bestchenyan opened this issue ยท 1 comments
๐ Bug Report
I cannot submit or test my code properly when I am working on Question 59.The error is as follows:
To Reproduce
The same code can be successfully submitted on the LeetCode website. The code is as follows:
var generateMatrix = function (n) {
let output = new Array(n).fill(0).map(() => new Array(n).fill(0));
let count = 0;
let size = n * n;
let left = 0;
let right = n - 1;
let top = 0;
let bottom = n - 1;
while (count < size) {
//going left
for (let i = left; i <= right; i++) {
count++;
output[top][i] = count;
}
top++;
// going down
for (let i = top; i <= bottom; i++) {
count++;
output[i][right] = count;
}
right--;
//going left
for (let i = right; i >= left; i--) {
count++;
output[bottom][i] = count;
}
bottom--;
//going up
for (let i = bottom; i >= top; i--) {
count++;
output[i][left] = count;
}
left++;
}
return output;
};
Expected behavior
The code can be submitted successfully in LeetCode extension.
Extension Output
- Waiting for judge result
- Waiting for judge result
- Waiting for judge result
undefined:1
^
SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse ()
at Request._callback (c:\Users\38401.vscode\extensions\leetcode.vscode-leetcode-0.18.1\node_modules\vsc-leetcode-cli\lib\plugins\leetcode.js:231:23)
at Request.self.callback (c:\Users\38401.vscode\extensions\leetcode.vscode-leetcode-0.18.1\node_modules\request\request.js:185:22)
at Request.emit (events.js:400:28)
at Request. (c:\Users\38401.vscode\extensions\leetcode.vscode-leetcode-0.18.1\node_modules\request\request.js:1161:10)
at Request.emit (events.js:400:28)
at IncomingMessage. (c:\Users\38401.vscode\extensions\leetcode.vscode-leetcode-0.18.1\node_modules\request\request.js:1083:12)
at Object.onceWrapper (events.js:519:28)
at IncomingMessage.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1333:12)
- Waiting for judge result
undefined:1
^
SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse ()
at Request._callback (c:\Users\38401.vscode\extensions\leetcode.vscode-leetcode-0.18.1\node_modules\vsc-leetcode-cli\lib\plugins\leetcode.js:231:23)
at Request.self.callback (c:\Users\38401.vscode\extensions\leetcode.vscode-leetcode-0.18.1\node_modules\request\request.js:185:22)
at Request.emit (events.js:400:28)
at Request. (c:\Users\38401.vscode\extensions\leetcode.vscode-leetcode-0.18.1\node_modules\request\request.js:1161:10)
at Request.emit (events.js:400:28)
at IncomingMessage. (c:\Users\38401.vscode\extensions\leetcode.vscode-leetcode-0.18.1\node_modules\request\request.js:1083:12)
at Object.onceWrapper (events.js:519:28)
at IncomingMessage.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1333:12)
- Sending code to judge
(node:12396) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Usenode --trace-warnings ...
to show where the warning was created)
[ERROR] http error [code=429]
Your Environment
-
os:Windows11 x64
-
extension settings:
// Add difficulty badge and colorize problems files in explorer tree.
"leetcode.colorizeProblems": true,// Default language for solving the problems.
"leetcode.defaultLanguage": "",// Customize the shortcuts in editors.
// - submit: Submit your answer to LeetCode.
// - test: Test your answer with customized test cases.
// - star: Star or unstar the current problem.
// - solution: Show the top voted solution for the current problem.
// - description: Show the problem description page.
"leetcode.editor.shortcuts": [
"submit",
"test"
],// Determine whether to group all webview pages into the second editor column when solving problems.
"leetcode.enableSideMode": true,// Show the LeetCode status bar or not.
"leetcode.enableStatusBar": true,// Endpoint of the user account.
"leetcode.endpoint": "leetcode",// The output folder and filename to save the problem files.
"leetcode.filePath": {
"default": {
"folder": "",
"filename": "${id}.${kebab-case-name}.${ext}"
}
},// Hide solved problems.
"leetcode.hideSolved": false,// Show a hint to configure commands key binding.
"leetcode.hint.commandShortcut": true,// Show a hint to enable comment description in solution code file.
"leetcode.hint.commentDescription": true,// Show a hint to change webview appearance through markdown config.
"leetcode.hint.configWebviewMarkdown": true,// Show a hint to set the default language.
"leetcode.hint.setDefaultLanguage": true,// The Node.js executable path. for example, C:\Program Files\nodejs\node.exe
"leetcode.nodePath": "node",// Sorting strategy for problems list.
"leetcode.problems.sortStrategy": "None",// This setting will be deprecated in 0.17.0, please use 'leetcode.showDescription' instead
// [Deprecated] Include problem description in comments.
"leetcode.showCommentDescription": false,// Specify where to show the description.
// - In Webview: Show the problem description in a new webview window
// - In File Comment: Show the problem description in the file's comment
"leetcode.showDescription": "In Webview",// Show locked problems.
"leetcode.showLocked": false,// Use endpoint's translation (if available)
"leetcode.useEndpointTranslation": true,// Use the Windows Subsystem for Linux.
"leetcode.useWsl": false,// The path of the workspace folder to store the problem files.
"leetcode.workspaceFolder": "", -
nodejs version: v14.21.3
-
vscode version: v1.79.0
-
extension version: 0.18.1
Sorry,, it's my fault.
My lang setting was incorrect. It should have been 'javascript'. When I did a global replace, I replaced the letter 'j' with the letter 'y'.