From 837b3c059f1e24ceeebcf5d2b8678a2b8f47b57d Mon Sep 17 00:00:00 2001 From: Deepanshudeep <138997807+deepanshudeep24@users.noreply.github.com> Date: Sat, 12 Apr 2025 03:41:56 +0530 Subject: [PATCH 1/2] README_EN.md --- .../README_EN.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/solution/2400-2499/2414.Length of the Longest Alphabetical Continuous Substring/README_EN.md b/solution/2400-2499/2414.Length of the Longest Alphabetical Continuous Substring/README_EN.md index 4f7e9a104ccb2..8fe8aee35f4cb 100644 --- a/solution/2400-2499/2414.Length of the Longest Alphabetical Continuous Substring/README_EN.md +++ b/solution/2400-2499/2414.Length of the Longest Alphabetical Continuous Substring/README_EN.md @@ -195,6 +195,25 @@ int longestContinuousSubstring(char* s) { return ans; } ``` +###js +```JavaScript + * @param {string} s + * @return {number} + */ +var longestContinuousSubstring = function(s) { + let max = 0, curr = 0, prev = 0, i = 0, c = 0; + + while (i < s.length) { + c = s.charCodeAt(i); + curr = (c === prev + 1) ? curr + 1 : 1; + max = (curr > max) ? curr : max; + prev = c; + i++; + } + + + return max; +};``` From eabff96d412aac310b735556ac3dac037c4cd6cb Mon Sep 17 00:00:00 2001 From: deepanshudeep24 <138997807+deepanshudeep24@users.noreply.github.com> Date: Fri, 11 Apr 2025 23:09:51 +0000 Subject: [PATCH 2/2] style: format code and docs with prettier --- .../README_EN.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/solution/2400-2499/2414.Length of the Longest Alphabetical Continuous Substring/README_EN.md b/solution/2400-2499/2414.Length of the Longest Alphabetical Continuous Substring/README_EN.md index 8fe8aee35f4cb..3950287058347 100644 --- a/solution/2400-2499/2414.Length of the Longest Alphabetical Continuous Substring/README_EN.md +++ b/solution/2400-2499/2414.Length of the Longest Alphabetical Continuous Substring/README_EN.md @@ -195,8 +195,10 @@ int longestContinuousSubstring(char* s) { return ans; } ``` + ###js -```JavaScript + +````JavaScript * @param {string} s * @return {number} */ @@ -220,3 +222,4 @@ var longestContinuousSubstring = function(s) { +````