Laufzeitfehler in Leetcode in JavaScript, aber der Computer funktioniert einwandfrei

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Laufzeitfehler in Leetcode in JavaScript, aber der Computer funktioniert einwandfrei

by Anonymous » 17 Feb 2025, 08:09

var lengthOfLongestSubstring = function (s) {
let uniqueSubString = ""
for (let i = 0; i < s.length; i++) {
let substring = s
for (let j = i + 1; j < s.length; j++) {
if (substring.includes(s[j])) {
break
} else {
substring += s[j]
}
}
if (uniqueSubString.length < substring.length) {
uniqueSubString = substring
}

}

return uniqueSubString.length
};
< /code>
Runtime Error
undefined:1
SyntaxError: Unexpected end of JSON input
at JSON.parse ()
Line 44: Char 17 in deserializer.js (deserializer.toString)
Line 32: Char 36 in solution.js (Object.)
Line 16: Char 8 in runner.js (Object.runner)
Line 24: Char 26 in solution.js (Object.)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
Node.js v20.10.0
< /code>
get this error when running in leetcode. in other compilers it work accurately.

it works and provide right output for all compiler but when try to run in leetcode it gets the error

Top