Generate a JSON object suitable for automating the programming task…
- User
Assistant: User: Generate a JSON object suitable for automating the programming task testing platform, strictly in the following format:
{ "Title": "Task Name", "Task Description": "Description of the task.", "Function Signature": "def function_name(parameters) -> return_type:", "Solve": "Python code for the solution", "Input": "Description of the input parameters.", "Output": "Description of the expected output.", "Examples": [ { "input": "Example input here", "output": "Expected output here" }, { "input": "Another example input here", "output": "Another expected output here" } ] } Ensure that the JSON follows this exact structure and does not include any additional text or variations. The task should be complex, hard and unique.
Assistant:
- Assistant
{ "Title": "Permutation in String", "Task Description": "Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string's permutations is a substring of the second string.", "Function Signature": "def check_inclusion(s1: str, s2: str) -> bool:", "Solve": "def check_inclusion(s1: str, s2: str) -> bool:\n from collections import Counter\n n, m = len(s1), len(s2)\n if n > m:\n return False\n s1_count = Counter(s1)\n s2_count = Counter(s2[:n])\n if s1_count == s2_count:\n return True\n for i in range(n, m):\n s2_count[s2[i]] += 1\n s2_count[s2[i - n]] -= 1\n if s2_count[s2[i - n]] == 0:\n del s2_count[s2[i - n]]\n if s1_count == s2_count:\n return True\n return False", "Input": "Two strings, s1 and s2, where 1 <= len(s1) <= len(s2) <= 104.", "Output": "Boolean value indicating whether any permutation of s1 is present in s2 as a substring.", "Examples": [ { "input": "s1 = \"ab\", s2 = \"eidbaooo\"", "output": "True" }, { "input": "s1 = \"ab\", s2 = \"eidboaoo\"", "output": "False" } ] }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.