11/*
2- * Problem: Longest Palindromic Substring
2+ * Problem:5. Longest Palindromic Substring
33 * Acceptance Rate: 31.0%
44 * URL: https://leetcode.com/problems/longest-palindromic-substring/
55 *
66 * Runtime: 96 ms, faster than 96.82% of TypeScript online submissions for Longest Palindromic Substring.
77 * Memory Usage: 41.9 MB, less than 65.68% of TypeScript online submissions for Longest Palindromic Substring.
88 */
99
10- export default class Solution {
10+ export default function longestPalindromeIn ( s :string ) :string {
11+ // let result = Solution.findLongestPalindrome(s);
12+ // console.log(s, "->", result);
13+ // return result;
14+
15+ return Solution . findLongestPalindrome ( s ) ;
16+ } ;
17+
18+ class Solution {
1119
1220private static startIndex :number ;
1321private static palindromeLength :number ;
@@ -26,13 +34,13 @@ export default class Solution {
2634return s . substring ( Solution . startIndex , Solution . startIndex + Solution . palindromeLength ) ;
2735} ;
2836
29- private static extendPalindromeEvenLength ( s :string , startingIndex :number ) {
30- let left = startingIndex , right = startingIndex + 1 ;
37+ private static extendPalindromeOddLength ( s :string , startingIndex :number ) {
38+ let left = startingIndex , right = startingIndex ;
3139Solution . extendPalindrome ( s , left , right ) ;
3240}
3341
34- private static extendPalindromeOddLength ( s :string , startingIndex :number ) {
35- let left = startingIndex , right = startingIndex ;
42+ private static extendPalindromeEvenLength ( s :string , startingIndex :number ) {
43+ let left = startingIndex , right = startingIndex + 1 ;
3644Solution . extendPalindrome ( s , left , right ) ;
3745}
3846
@@ -65,14 +73,6 @@ export default class Solution {
6573}
6674}
6775
68- function longestPalindromeIn ( s :string ) :string {
69- let result = Solution . findLongestPalindrome ( s ) ;
70-
71- console . log ( s , "->" , result ) ;
72-
73- return result ;
74- } ;
75-
7676//---------------------------------------------------------------------
7777// ---------- MAIN PROGRAM ----------
7878//---------------------------------------------------------------------
@@ -82,7 +82,7 @@ if(import.meta.main) {
8282longestPalindromeIn ( "cbbd" ) ;
8383longestPalindromeIn ( "weloveracecars" ) ;
8484
85- // RUN: deno runMedium /LongestPalindromicSubstring.ts
85+ // RUN: deno runmedium /LongestPalindromicSubstring.ts
8686}
8787
8888// --------------------------- Terminal Output: ---------------------------