Fix JSON object suitable for automating the programming task testing…
- User
Assistant: User: Fix JSON object suitable for automating the programming task testing platform, strictly in the following format.Often the errors are in "Solve", "Examples":
{ "Title": "Longest Palindromic Substring", "Task Description": "Given a string, find the longest substring that is a palindrome.", "Function Signature": "def longest_palindrome(s: str) -> str:", "Solve": "def longest_palindrome(s: str) -> str:\n if not s:\n return ""\n start, end = 0, 0\n for i in range(len(s)):\n len1 = expand_around_center(s, i, i)\n len2 = expand_around_center(s, i, i + 1)\n max_len = max(len1, len2)\n if max_len > end - start:\n start = i - (max_len - 1) // 2\n end = i + max_len // 2\n return s[start:end + 1]\n\ndef expand_around_center(s, left, right):\n while left >= 0 and right < len(s) and s[left] == s[right]:\n left -= 1\n right += 1\n return right - left - 1", "Input": "A string 's' where 1 <= len(s) <= 1000.", "Output": "The longest palindromic substring in 's'.", "Examples": [ { "input": "babad", "output": "bab" }, { "input": "cbbd", "output": "bb" } ] }
Ensure that the JSON follows this exact structure and does not include any additional text or variations. The task should be complex and unique, avoiding direct copying from common platforms like LeetCode or similar sources.
Assistant:
- Assistant
{ "Title": "Longest Palindromic Substring", "Task Description": "Given a string, find the longest substring that is a palindrome.", "Function Signature": "def longest_palindrome(s: str) -> str:", "Solve": "def longest_palindrome(s: str) -> str:\n if not s:\n return ""\n start, end = 0, 0\n for i in range(len(s)):\n len1 = expand_around_center(s, i, i)\n len2 = expand_around_center(s, i, i + 1)\n max_len = max(len1, len2)\n if max_len > end - start:\n start = i - (max_len - 1) // 2\n end = i + max_len // 2\n return s[start:end + 1]\n\ndef expand_around_center(s, left, right):\n while left >= 0 and right < len(s) and s[left] == s[right]:\n left -= 1\n right += 1\n return right - left - 1", "Input": "A string 's' where 1 <= len(s) <= 1000.", "Output": "The longest palindromic substring in 's'.", "Examples": [ { "input": "babad", "output": "bab" }, { "input": "cbbd", "output": "bb" } ] }